Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On 14/07/12 01:49, julien2412 wrote:
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 ... ?

hmm... it appears that this code is essentially unchanged since the
initial import, except that the comment "can happen when... " there has
been translated from the original Klingon.

so pView ultimately comes from SfxViewFrame::Current(), dynamically
casted to SwView... i bet the idea is that null pView is never supposed
to happen, and the comment indicates that a certain "TH" was at some
time tasked with fixing the bug that it could indeed be null at that time.

since it has been unconditionally dereferenced for the last 12 years at
least anyway, i think the check is just redundant and could be removed.


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.