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