Browse Source

fix memory error in json validation

Kolja Strohm 7 months ago
parent
commit
941b1d4d93
1 changed files with 4 additions and 4 deletions
  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