diff --git a/src/sbml/SBase.cpp b/src/sbml/SBase.cpp index e28212f82d..48c45ee316 100644 --- a/src/sbml/SBase.cpp +++ b/src/sbml/SBase.cpp @@ -2361,11 +2361,8 @@ SBase::setCreatedDate(Date* date) } else { - ModelHistory* mh = new ModelHistory(); - // we want to set it regardless of content - mHistory = static_cast(mh->clone()); + mHistory = new ModelHistory(); mHistoryChanged = true; - delete mh; return mHistory->setCreatedDate(date); @@ -2381,11 +2378,8 @@ SBase::addModifiedDate(Date* date) } else { - ModelHistory* mh = new ModelHistory(); - // we want to set it regardless of content - mHistory = static_cast(mh->clone()); + mHistory = new ModelHistory(); mHistoryChanged = true; - delete mh; return mHistory->addModifiedDate(date); @@ -2979,7 +2973,7 @@ SBase::unsetCreatedDate() if (mHistory != NULL && mHistory->isSetCreatedDate()) { mHistoryChanged = true; - } + } else { return LIBSBML_UNEXPECTED_ATTRIBUTE; @@ -3014,7 +3008,7 @@ SBase::unsetModifiedDates() if (mHistory != NULL && mHistory->isSetModifiedDate()) { mHistoryChanged = true; - } + } else { return LIBSBML_UNEXPECTED_ATTRIBUTE;