add missing CAutoFile::IsNull() check in main

Rebased-From: ccd056a30db0ba5e04b858a682907b378e464d34
Github-Pull: #5437