Possible null pointer dereference in sw/source/ui/misc/redlndlg.cxx

julien2412 serval2412 at yahoo.fr
Fri Jul 13 16:49:36 PDT 2012


Hello,

On master sources updated today, cppcheck reported this :
[sw/source/ui/misc/redlndlg.cxx:402]: (error) Possible null pointer
dereference: pView - otherwise it is redundant to check if pView is null at
line 406

    395 void SwRedlineAcceptDlg::Activate()
    396 {
    397     // prevent update if flag is set (#102547#)
    398     if( bInhibitActivate )
    399         return;
    400 
    401     SwView *pView = ::GetActiveView();
    402     SwWait aWait( *pView->GetDocShell(), sal_False );
    403 
    404     aUsedSeqNo.Remove((sal_uInt16)0, aUsedSeqNo.Count());
    405 
    406     if (!pView) // can happen when switching to another app, when a
Listbox in the dialog
    407         return; // had the focus previously (actually THs Bug)

Should we test pView just after having tested bInhibitActivate or should we
keep this :
aUsedSeqNo.Remove((sal_uInt16)0, aUsedSeqNo.Count());
before testing pView ?

Julien

--
View this message in context: http://nabble.documentfoundation.org/Possible-null-pointer-dereference-in-sw-source-ui-misc-redlndlg-cxx-tp3995385.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list