add missing CAutoFile::IsNull() check in main

Rebased-From: 84857e87e42e412336ea60d0f8544c1679bab827
Github-Pull: #5437