[FIX] Защита от дурака - проверки на null update*

This commit is contained in:
Gravit 2019-07-16 04:28:19 +07:00
parent 3c4b1a2543
commit 85c1985435
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -14,6 +14,7 @@
import pro.gravit.launcher.LauncherAPI; import pro.gravit.launcher.LauncherAPI;
import pro.gravit.launcher.hasher.FileNameMatcher; import pro.gravit.launcher.hasher.FileNameMatcher;
import pro.gravit.launcher.hasher.HashedDir; import pro.gravit.launcher.hasher.HashedDir;
import pro.gravit.launcher.profiles.optional.OptionalDepend;
import pro.gravit.launcher.profiles.optional.OptionalFile; import pro.gravit.launcher.profiles.optional.OptionalFile;
import pro.gravit.launcher.profiles.optional.OptionalType; import pro.gravit.launcher.profiles.optional.OptionalType;
import pro.gravit.utils.helper.IOHelper; import pro.gravit.utils.helper.IOHelper;
@ -402,6 +403,16 @@ public void verify() {
// Client launcher // Client launcher
VerifyHelper.verify(getTitle(), VerifyHelper.NOT_EMPTY, "Main class can't be empty"); VerifyHelper.verify(getTitle(), VerifyHelper.NOT_EMPTY, "Main class can't be empty");
for (String s : update) {
if (s == null) throw new IllegalArgumentException("Found null entry in update");
}
for (String s : updateVerify) {
if (s == null) throw new IllegalArgumentException("Found null entry in updateVerify");
}
for (String s : updateExclusions) {
if (s == null) throw new IllegalArgumentException("Found null entry in updateExclusions");
}
for (String s : classPath) { for (String s : classPath) {
if (s == null) throw new IllegalArgumentException("Found null entry in classPath"); if (s == null) throw new IllegalArgumentException("Found null entry in classPath");
} }
@ -415,6 +426,15 @@ public void verify() {
if (f == null) throw new IllegalArgumentException("Found null entry in updateOptional"); if (f == null) throw new IllegalArgumentException("Found null entry in updateOptional");
if (f.name == null) throw new IllegalArgumentException("Optional: name must not be null"); if (f.name == null) throw new IllegalArgumentException("Optional: name must not be null");
if (f.list == null) throw new IllegalArgumentException("Optional: list must not be null"); if (f.list == null) throw new IllegalArgumentException("Optional: list must not be null");
for (String s : f.list) {
if (s == null) throw new IllegalArgumentException(String.format("Found null entry in updateOptional.%s.list", f.name));
}
if(f.conflictFile != null) for (OptionalDepend s : f.conflictFile) {
if (s == null) throw new IllegalArgumentException(String.format("Found null entry in updateOptional.%s.conflictFile", f.name));
}
if(f.dependenciesFile != null) for (OptionalDepend s : f.dependenciesFile) {
if (s == null) throw new IllegalArgumentException(String.format("Found null entry in updateOptional.%s.dependenciesFile", f.name));
}
} }
} }