Browse Source

fix a newly introduced NPE

master
Adrian Siekierka 2 years ago
parent
commit
700438a7b5
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      src/pl/asie/modalyze/ModAnalyzer.java

+ 7
- 2
src/pl/asie/modalyze/ModAnalyzer.java View File

@@ -89,7 +89,10 @@ public class ModAnalyzer {
89 89
             }
90 90
 
91 91
             if (data.containsKey("version")) {
92
-                versionsFound.add((String) data.get("version"));
92
+                String v = (String) data.get("version");
93
+                if (v != null && v.length() > 0) {
94
+                    versionsFound.add(v);
95
+                }
93 96
             }
94 97
 
95 98
             String dependencyStr = data.containsKey("dependencies") ? ((String) data.get("dependencies"))
@@ -280,7 +283,9 @@ public class ModAnalyzer {
280 283
                 metadata.provides = StringUtils.append(metadata.provides, entry.modid);
281 284
                 metadata.name = StringUtils.selectLonger(entry.name, metadata.name);
282 285
                 metadata.description = StringUtils.select(entry.description, metadata.description);
283
-                versionsFound.add(entry.version);
286
+                if (entry.version != null && entry.version.length() > 0) {
287
+                    versionsFound.add(entry.version);
288
+                }
284 289
                 metadata.homepage = StringUtils.select(entry.url, metadata.homepage);
285 290
                 if (entry.mcversion != null && ModAnalyzerUtils.isValidMcVersion(entry.mcversion)) {
286 291
                     metadata.dependencies = addDependency(metadata.dependencies, "minecraft@" + entry.mcversion);

Loading…
Cancel
Save