If statement to identify an image exists in a pixmap

This is because I want a button to open up an imageVewer (based on Qt example) to display a fullscreen view of the image in the pixmap but only if an image exists in the pixmap, otherwise don’t do anything.

This is the only thing so far I have been able to compile but if there is no image in the pixmap it just crashes the application. If an image exists it works. I have declared viewImage in the header and all that works, so it’s just how to write the conditional part that I’m interested in.