It's an OSG smart pointer.  It's just checking it points to something non-null.  Technically speaking the previous statement was actually entirely appropriate (except for not having a graceful failure path).  However, I'd change it just so when grepping the code for Q_ASSERT it doesn't seem like another of thiese errors.

Just replace it with 

    osg::osgViewer *viewer = m_viewer.get();
    Q_ASSERT(viewer)
    if (viewer == NULL) return;

I don't think a comment is needed here because if we start commenting how every use of OSG smart pointers are used it will be a disaster.