Fix a fatal error occurs in combination with a scaffold error.
Merge pull request #4122 from chinpei215/master-scaffold-error-fix

Fix a fatal error occurs in combination with a scaffold error.