Prior this commit we were always dereferencing the image bitmap pointer, even if it was null, which resulted in a crash when trying to open the context menu when an image wasn't loaded. Closes: #10178