qt5base: add NULL pointer check

Apparently, there exist situations for which the current OpenGL context might not exist or is invalid