Issue 109921 - sw: meaningless tests against NULL
Summary: sw: meaningless tests against NULL
Status: CLOSED FIXED
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: DEV300m73
Hardware: All Linux, all
: P3 Trivial (vote)
Target Milestone: ---
Assignee: caolanm
QA Contact: issues@sw
URL:
Keywords:
: 110771 (view as issue list)
Depends on:
Blocks: 106602
  Show dependency tree
 
Reported: 2010-03-08 12:05 UTC by caolanm
Modified: 2013-08-07 14:44 UTC (History)
2 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
clean these up (2.85 KB, patch)
2010-03-08 12:05 UTC, caolanm
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description caolanm 2010-03-08 12:05:08 UTC
in sw/source/core/frmedt/feshview.cxx we first check 

if (pTmpObj)...
 ...
 if (pTmpObj)
 else
    foo

Seeing as pTmpObj is not null, and is not modified afterwards, the foo branch
can never be executed so patch to remove it attached.

Similarly in sw/source/ui/uno/unotxvw.cxx we have...
SwWrtShell* pOldSh = &m_pView->GetWrtShell();
if (pOldSh)
  foo

Its not possible to pOldSh to not be NULL, so the if doesn't make any real
sense. Patch also cleans that up.
Comment 1 caolanm 2010-03-08 12:05:45 UTC
Created attachment 68212 [details]
clean these up
Comment 2 mst.ooo 2010-03-17 13:49:22 UTC
at first i was a bit concerned about the change in feshview.cxx, but it seems
the return value of GetMarkedSdrObj() is not checked anywhere in that file, so i
suppose it works :)

the pointer in unotxvw.cxx is completely, err, pointless.

thanks for the patch!
Comment 3 mst.ooo 2010-03-17 13:52:00 UTC
fixed in cws sw33bf03:
http://hg.services.openoffice.org/hg/cws/sw33bf03/rev/5ef8f3c98a50
Comment 4 mst.ooo 2010-04-12 10:28:08 UTC
*** Issue 110771 has been marked as a duplicate of this issue. ***
Comment 5 mst.ooo 2010-04-29 13:04:50 UTC
please verify
Comment 6 caolanm 2010-04-29 13:14:54 UTC
verified, dead tests removed, logic unchanged
Comment 7 caolanm 2010-05-26 16:17:31 UTC
integrated DEV300_m79