diff --git a/include/class_board_item.h b/include/class_board_item.h index 11676e418d..183aad9bb3 100644 --- a/include/class_board_item.h +++ b/include/class_board_item.h @@ -172,11 +172,13 @@ public: /** * Function DeleteStructure - * deletes this object after UnLink()ing it from its owner. + * deletes this object after UnLink()ing it from its owner if it has one. */ void DeleteStructure() { - UnLink(); + if( GetList() != NULL ) + UnLink(); + delete this; }