The code wasn't checking if parsing an image failed and just returning success. Testcase from bug is attached. Fixes #4101