Преглед на файлове

fix memory error in json validation

Kolja Strohm преди 1 година
родител
ревизия
941b1d4d93
променени са 1 файла, в които са добавени 4 реда и са изтрити 4 реда
  1. 4 4
      JSON.cpp

+ 4 - 4
JSON.cpp

@@ -1135,11 +1135,11 @@ JSONValue* JSONNoTypeMatching::getValidPart(
     RCArray<JSONValidationResult> tempErrors;
     for (JSONValidationResult* reason : reasons)
     {
-        JSONValue *result = reason->getValidPart(&tempErrors);
+        JSONValue* result = reason->getValidPart(&tempErrors);
         if (result)
         {
-			return result;
-		}
+            return result;
+        }
     }
     if (removedPartsValidationResults)
     {
@@ -1148,7 +1148,7 @@ JSONValue* JSONNoTypeMatching::getValidPart(
         reasons.leeren();
         for (JSONValidationResult* error : tempErrors)
         {
-            reasons.add(error);
+            reasons.add(dynamic_cast<JSONValidationResult*>(error->getThis()));
         }
     }
     // multiple possibilities are undecidable