Everything seems to be working, so instead of crashing just print an error and return. Fixes #6597 (cherry picked from commit ceba851d44)
ceba851d44