Browse Source

Make parseJson safer

Hugo Fonseca 10 years ago
parent
commit
e79d067690
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/Composer/Json/JsonFile.php

+ 3 - 0
src/Composer/Json/JsonFile.php

@@ -253,6 +253,9 @@ class JsonFile
      */
     public static function parseJson($json, $file = null)
     {
+        if (null === $json) {
+            return;
+        }
         $data = json_decode($json, true);
         if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
             self::validateSyntax($json, $file);