fix crash loading JPEGs where m_cinfo.scale_num was set to 9 due to not finding a suitably sized scale factor. Thanks to tscheck
[osx/sdl] - fix possible NPE - fixes #14676