Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Commit

Permalink
Fix #296 (#297)
Browse files Browse the repository at this point in the history
* ModuleManager safety

* Module wasn't spelled correctly, causing NPE.
  • Loading branch information
EmotionalLove authored and 5HT2 committed Dec 18, 2019
1 parent 52af5bb commit 27dda1b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class MixinC00Handshake {

@Inject(method = "writePacketData", at = @At(value = "HEAD"), cancellable = true)
public void writePacketData(PacketBuffer buf, CallbackInfo info) {
if (ModuleManager.isModuleEnabled("FakeVanilla")) {
if (ModuleManager.isModuleEnabled("FakeVanillaClient")) {
info.cancel();
buf.writeVarInt(protocolVersion);
buf.writeString(ip);
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/me/zeroeightsix/kami/module/ModuleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ public static ArrayList<Module> getModules() {


public static Module getModuleByName(String name) {
return modules.get(lookup.get(name.toLowerCase()));
Integer index = lookup.get(name.toLowerCase());
if (index == null) {
throw new IllegalArgumentException("getModuleByName() failed. Are you calling this too early? Is the module spelled correctly? Please check!!!!");
}
return modules.get(index);
}

public static boolean isModuleEnabled(String moduleName) {
Expand Down

0 comments on commit 27dda1b

Please sign in to comment.