From bf0cc7bea8f9e8a744098d680bdf521e343dc4db Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Tue, 18 Oct 2016 13:53:00 +0800 Subject: [PATCH] Fixed a bug for SchemaDocument move constructor --- include/rapidjson/schema.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/rapidjson/schema.h b/include/rapidjson/schema.h index 6f1611f..178e91c 100644 --- a/include/rapidjson/schema.h +++ b/include/rapidjson/schema.h @@ -1339,6 +1339,7 @@ public: allocator_(allocator), ownAllocator_(), root_(), + typeless_(), schemaMap_(allocator, kInitialSchemaMapSize), schemaRef_(allocator, kInitialSchemaRefSize) { @@ -1398,8 +1399,10 @@ public: while (!schemaMap_.Empty()) schemaMap_.template Pop(1)->~SchemaEntry(); - typeless_->~SchemaType(); - Allocator::Free(typeless_); + if (typeless_) { + typeless_->~SchemaType(); + Allocator::Free(typeless_); + } RAPIDJSON_DELETE(ownAllocator_); }