DLIST: replace wxASSERT with wxCHECK for checks that would lead to a crash

wxASSERT only shows a dialog saying that things went wrong (in debug mode),
whereas wxCHECK will also terminate the function (also in release builds).
This commit is contained in:
Maciej Suminski 2018-05-04 15:10:44 +02:00
parent ef698384a7
commit d2d5657aff
1 changed files with 5 additions and 6 deletions

View File

@ -58,11 +58,11 @@ void DHEAD::DeleteAll()
void DHEAD::append( EDA_ITEM* aNewElement ) void DHEAD::append( EDA_ITEM* aNewElement )
{ {
wxASSERT( aNewElement != NULL ); wxCHECK( aNewElement, /*void*/ );
if( first ) // list is not empty, first is not touched if( first ) // list is not empty, first is not touched
{ {
wxASSERT( last != NULL ); wxCHECK( last, /*void*/ );
aNewElement->SetNext( 0 ); aNewElement->SetNext( 0 );
aNewElement->SetBack( last ); aNewElement->SetBack( last );
@ -118,13 +118,13 @@ void DHEAD::append( DHEAD& aList )
void DHEAD::insert( EDA_ITEM* aNewElement, EDA_ITEM* aAfterMe ) void DHEAD::insert( EDA_ITEM* aNewElement, EDA_ITEM* aAfterMe )
{ {
wxASSERT( aNewElement != NULL ); wxCHECK( aNewElement, /*void*/ );
if( !aAfterMe ) if( !aAfterMe )
append( aNewElement ); append( aNewElement );
else else
{ {
wxASSERT( aAfterMe->GetList() == this ); wxCHECK( aAfterMe->GetList() == this, /*void*/ );
// the list cannot be empty if aAfterMe is supposedly on the list // the list cannot be empty if aAfterMe is supposedly on the list
wxASSERT( first && last ); wxASSERT( first && last );
@ -159,8 +159,7 @@ void DHEAD::insert( EDA_ITEM* aNewElement, EDA_ITEM* aAfterMe )
void DHEAD::remove( EDA_ITEM* aElement ) void DHEAD::remove( EDA_ITEM* aElement )
{ {
wxASSERT( aElement ); wxCHECK( aElement && aElement->GetList() == this, /*void*/ );
wxASSERT( aElement->GetList() == this );
if( aElement->Next() ) if( aElement->Next() )
{ {