]> git.saurik.com Git - wxWidgets.git/commitdiff
assert when the item index is out of range in wxMSW's listctrl, just like generic...
authorFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Mon, 12 Jan 2009 19:34:42 +0000 (19:34 +0000)
committerFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Mon, 12 Jan 2009 19:34:42 +0000 (19:34 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58055 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/listctrl.cpp
tests/controls/listctrltest.cpp

index 9e23d1db3fb33a508d16b3c00c30b422e4b64639..f05ea49fb8ae085aba3b1ca30a4228ca52cc8ee9 100644 (file)
@@ -1162,6 +1162,10 @@ bool wxListCtrl::GetSubItemRect(long item, long subItem, wxRect& rect, int code)
                     (subItem >= 0 && subItem < GetColumnCount()),
                  false, _T("invalid sub item index") );
 
+    // use wxCHECK_MSG against "item" too, for coherency with the generic implementation:
+    wxCHECK_MSG( item >= 0 && item < GetItemCount(), false,
+                 _T("invalid item in GetSubItemRect") );
+
     int codeWin;
     if ( code == wxLIST_RECT_BOUNDS )
         codeWin = LVIR_BOUNDS;
index 6c88105420a8f070f192c6d7171bc0fdb2cfcc1a..5e615eb28397cc397acf6f9e47d239f1e99b2b2f 100644 (file)
@@ -159,7 +159,7 @@ void ListCtrlTestCase::ItemRect()
 
     // do test
     wxRect r;
-    //CPPUNIT_ASSERT( !m_list->GetItemRect(1, r) );   this asserts as item #1 does not exist
+    WX_ASSERT_FAILS_WITH_ASSERT( m_list->GetItemRect(1, r) );
     CPPUNIT_ASSERT( m_list->GetItemRect(0, r) );
     CPPUNIT_ASSERT_EQUAL( 150, r.GetWidth() );