File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ public static function gather() {
5555 if (!is_dir ($ annotationsDir )) {
5656 Console::writeWarning ("<path> " .Console::getHumanReadablePath ($ annotationsDir )."</path><warning> doesn't exist so you won't have annotations... " );
5757 mkdir ($ annotationsDir );
58+ } else {
59+
60+
5861 }
5962
6063 // find the markdown-based annotations
@@ -90,6 +93,7 @@ public static function gather() {
9093 }
9194
9295 // read in the old style annotations.js, modify the data and generate JSON array to merge
96+ $ data = array ();
9397 $ oldStyleAnnotationsPath = $ annotationsDir .DIRECTORY_SEPARATOR ."annotations.js " ;
9498 if (file_exists ($ oldStyleAnnotationsPath )) {
9599 $ text = trim (file_get_contents ($ oldStyleAnnotationsPath ));
@@ -103,8 +107,10 @@ public static function gather() {
103107 }
104108 }
105109
106- // merge in any data from the old file
107- self ::$ store ["comments " ] = array_merge (self ::$ store ["comments " ],$ data ["comments " ]);
110+ // merge in any data from the old file if the json decode was successful
111+ if (is_array ($ data ) && isset ($ data ["comments " ])) {
112+ self ::$ store ["comments " ] = array_merge (self ::$ store ["comments " ],$ data ["comments " ]);
113+ }
108114
109115 $ dispatcherInstance ->dispatch ("annotations.gatherEnd " );
110116
You can’t perform that action at this time.
0 commit comments