diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-03-27 14:51:14 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-10 13:13:46 +0100 |
commit | 49dadad0b55f879ebe5daf539a97043d283ad0a8 (patch) | |
tree | cf24f2c61231b309464e9b413566f8e15ee0a84f | |
parent | 7df35a2e92fa9fb548bbca0d0935f055e56e6d10 (diff) |
Encourage disposed toolbox items to play nicely.
Change-Id: I4a28ba4740e9c84666cd85c046598862f20a7a96
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 574705a9d4a6..3b1ad8f613a3 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -867,7 +867,7 @@ void ToolBox::SetPageScroll( bool b ) sal_uInt16 ToolBox::GetItemCount() const { - return (sal_uInt16)mpData->m_aItems.size(); + return mpData ? (sal_uInt16)mpData->m_aItems.size() : 0; } ToolBoxItemType ToolBox::GetItemType( sal_uInt16 nPos ) const @@ -877,11 +877,13 @@ ToolBoxItemType ToolBox::GetItemType( sal_uInt16 nPos ) const sal_uInt16 ToolBox::GetItemPos( sal_uInt16 nItemId ) const { - int nCount = mpData->m_aItems.size(); - for( int nPos = 0; nPos < nCount; nPos++ ) - if( mpData->m_aItems[nPos].mnId == nItemId ) - return (sal_uInt16)nPos; - + if (mpData) + { + int nCount = mpData->m_aItems.size(); + for( int nPos = 0; nPos < nCount; nPos++ ) + if( mpData->m_aItems[nPos].mnId == nItemId ) + return (sal_uInt16)nPos; + } return TOOLBOX_ITEM_NOTFOUND; } |