瀏覽代碼

[cpp] Return error when default skin can not be parsed in SkeletonBinary.

Mario Zechner 1 年之前
父節點
當前提交
d344c148ae
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp

+ 6 - 0
spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp

@@ -274,6 +274,12 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
 		skeletonData->_skins.add(defaultSkin);
 	}
 
+    if (!this->getError().isEmpty()) {
+        delete input;
+        delete skeletonData;
+        return NULL;
+    }
+
 	/* Skins. */
 	for (size_t i = 0, n = (size_t) readVarint(input, true); i < n; ++i) {
 		Skin *skin = readSkin(input, false, skeletonData, nonessential);