Not resize empty vectors.

closes https://github.com/assimp/assimp/issues/3754
pull/3755/head
Kim Kulling 2021-04-12 21:05:46 +02:00 committed by GitHub
parent c9ba616eb6
commit d1eeb80e1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -50,6 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp { namespace Assimp {
/// @brief Will find a node by its name.
struct find_node_by_name_predicate { struct find_node_by_name_predicate {
std::string mName; std::string mName;
find_node_by_name_predicate(const std::string &name) : find_node_by_name_predicate(const std::string &name) :
@ -88,7 +89,11 @@ public:
} }
void clear() { void clear() {
mData.resize(0); if(mData.empty() {
mDoc = nullptr;
return;
}
mData.clear();
delete mDoc; delete mDoc;
mDoc = nullptr; mDoc = nullptr;
} }