Skip to content

Commit

Permalink
Check if file to load patched mods for is empty.
Browse files Browse the repository at this point in the history
Signed-off-by: Ross Allan <rallanpcl@gmail.com>
  • Loading branch information
LunNova committed Jul 5, 2013
1 parent 00e28e0 commit 655c161
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/common/nallar/patched/forge/PatchRelaunchClassLoader.java
Expand Up @@ -138,12 +138,22 @@ private void loadPatchedClasses(URL url_, Map<String, byte[]> replacedClasses) {
log(Level.WARNING, null, "Not loading patched classes in " + url.replace("%", "%%") + ", replacedClasses was not set.");
return;
}
if (!url.isEmpty() && url.charAt(url.length() - 1) == '/') {
url = url.substring(0, url.length() - 1);
}
if (url.isEmpty() || ".".equals(url)) {
log(Level.WARNING, new Throwable(), "Failed to add patched classes from empty URL", url);
return;
}
File patchedModFile;
try {
patchedModFile = new File(patchedModsFolder, url.substring(url.lastIndexOf('/') + 1, url.length()));
if (!patchedURLs.add(patchedModFile.getAbsolutePath())) {
return;
}
if (patchedModsFolder.equals(patchedModFile)) {
throw new Exception("patched mods file = patched mods folder");
}
} catch (Exception e) {
log(Level.SEVERE, e, "Failed to add patched classes in URL %s", url);
return;
Expand Down

0 comments on commit 655c161

Please sign in to comment.