vcl/qa/cppunit/errorhandler.cxx | 7 +++++-- wizards/com/sun/star/wizards/ui/ButtonList.java | 9 +++++++-- 2 files changed, 12 insertions(+), 4 deletions(-)
New commits: commit a15d8458c67a769dd59e6237e012d6ec69331582 Author: Caolán McNamara <[email protected]> Date: Sun Apr 30 15:38:17 2017 +0100 coverity#1405740 Resource leak Change-Id: I6537e818a783ef908e2ae4d068752669529fb75e diff --git a/vcl/qa/cppunit/errorhandler.cxx b/vcl/qa/cppunit/errorhandler.cxx index defc218fac5f..fc06ec1869d2 100644 --- a/vcl/qa/cppunit/errorhandler.cxx +++ b/vcl/qa/cppunit/errorhandler.cxx @@ -45,17 +45,20 @@ public: void ErrorHandlerTest::testGetErrorString() { MockErrorHandler aErrHdlr; + std::unique_ptr<ErrorInfo> xErrorInfo; OUString aErrStr; CPPUNIT_ASSERT_MESSAGE("GetErrorString(ERRCODE_ABORT, aErrStr) should return false", !ErrorHandler::GetErrorString(ERRCODE_ABORT, aErrStr)); // normally protected, but MockErrorHandler is a friend of this class - aErrHdlr.CreateString(ErrorInfo::GetErrorInfo(ERRCODE_ABORT), aErrStr); + xErrorInfo.reset(ErrorInfo::GetErrorInfo(ERRCODE_ABORT)); + aErrHdlr.CreateString(xErrorInfo.get(), aErrStr); CPPUNIT_ASSERT_EQUAL_MESSAGE("error message should be non-dynamic", OUString("Non-dynamic error"), aErrStr); CPPUNIT_ASSERT_MESSAGE("GetErrorString(ERRCODE_NONE, aErrStr) should return false", !ErrorHandler::GetErrorString(ERRCODE_NONE, aErrStr)); - aErrHdlr.CreateString(ErrorInfo::GetErrorInfo(ERRCODE_NONE), aErrStr); + xErrorInfo.reset(ErrorInfo::GetErrorInfo(ERRCODE_NONE)); + aErrHdlr.CreateString(xErrorInfo.get(), aErrStr); CPPUNIT_ASSERT_EQUAL_MESSAGE("error message should be non-dynamic", OUString("Non-dynamic error"), aErrStr); } commit ccef4d977b87c470340dfc89ab590d718804f297 Author: Caolán McNamara <[email protected]> Date: Sun Apr 30 15:30:00 2017 +0100 coverity#1405739 Explicit null dereferenced Change-Id: If12d46d49936af3a91b2d50ca8fca43596eb4ae5 diff --git a/wizards/com/sun/star/wizards/ui/ButtonList.java b/wizards/com/sun/star/wizards/ui/ButtonList.java index 447a7d1325e4..522768bf8c07 100644 --- a/wizards/com/sun/star/wizards/ui/ButtonList.java +++ b/wizards/com/sun/star/wizards/ui/ButtonList.java @@ -464,14 +464,19 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener fireItemSelected(); } - /** * set the text under the button list */ private void refreshImageText() { + String sText; Object item = m_nCurrentSelection >= 0 ? getListModel().getElementAt(m_nCurrentSelection) : null; - final String sText = PropertyNames.SPACE + renderer.render(item); + if (item != null) { + sText = PropertyNames.SPACE + renderer.render(item); + } + else { + sText = ""; + } Helper.setUnoPropertyValue(getModel(lblImageText), PropertyNames.PROPERTY_LABEL, sText); }
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
