Check whether createNewImage has returned 0
This fixes a crash when pressing cancel when you're trying to create a RGB8 linear gamma image, which shouldn't be possible.