diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-06-10 21:32:54 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-06-10 22:11:33 +0100 |
commit | 88b104f44acff8087dfe3833bb91c63604ced98b (patch) | |
tree | 6c7aee2f8cf919d994e1b9640ab8c1dd921837f8 /basctl | |
parent | tdf#90640: add a unit test for this (diff) | |
download | core-88b104f44acff8087dfe3833bb91c63604ced98b.tar.gz core-88b104f44acff8087dfe3833bb91c63604ced98b.zip |
coverity#1302618 deref of NULL
on examination this PreparePaint virtual is only called from
SvTreeListBox::PaintEntry1
and PaintEntry1 is only called from SvImpLBox::Paint in a
for(sal_uInt16 n=0; n< nCount && pEntry; n++)
{
/*long nMaxRight=*/
pView->PaintEntry1
loop so pEntry always exists given that test. Re-jig things
so these families of method take a reference instead of a pointer
so verifying it cannot be NULL and a whole pile of else paths
fall away
Change-Id: Ied40acb1c2263c21b4447832f8cb86f64ed9e80d
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/moduldl2.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 822c0657f777..82189204bbaa 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -114,19 +114,19 @@ public: SvLBoxString( pEntry, nFlags, rTxt ) {} virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) SAL_OVERRIDE; }; void LibLBoxString::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) + const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry) { // Change text color if library is read only: bool bReadOnly = false; - if (pEntry && pEntry->GetUserData()) + if (rEntry.GetUserData()) { - ScriptDocument aDocument(static_cast<LibUserData*>(pEntry->GetUserData())->GetDocument()); + ScriptDocument aDocument(static_cast<LibUserData*>(rEntry.GetUserData())->GetDocument()); - OUString aLibName = static_cast<const SvLBoxString*>(pEntry->GetItem(1))->GetText(); + OUString aLibName = static_cast<const SvLBoxString*>(rEntry.GetItem(1))->GetText(); Reference<script::XLibraryContainer2> xModLibContainer(aDocument.getLibraryContainer(E_SCRIPTS), UNO_QUERY); Reference<script::XLibraryContainer2 > xDlgLibContainer(aDocument.getLibraryContainer(E_DIALOGS), UNO_QUERY); bReadOnly = (xModLibContainer.is() && xModLibContainer->hasByName(aLibName) && xModLibContainer->isLibraryReadOnly(aLibName)) |