Minor change to InputManager::deleteMapping(...)

As it is right now, if the mapping is null we get a logger output a warning, but the program continues and throws a NPE. I`d prefer if it did something like this instead:

[java]# This patch file was generated by NetBeans IDE

It uses platform neutral UTF-8 encoding and \n newlines.

— Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -602,8 +602,7 @@
if (mapping == null) {
//throw new IllegalArgumentException("Cannot find mapping: " + mappingName);
logger.log(Level.WARNING, “Cannot find mapping to be removed, skipping: {0}”, mappingName);

  •    }
    
  •    } else {
       ArrayList<Integer> triggers = mapping.triggers;
       for (int i = triggers.size() - 1; i >= 0; i--) {
           int hash = triggers.get(i);
    

@@ -611,6 +610,7 @@
maps.remove(mapping);
}
}

  • }

    /**

    • Deletes a specific trigger registered to a mapping.
      [/java]
1 Like

I added a return to the if block. I guess when the log.warn was added the return was forgotten (since the message says it will skip but then doesn’t.)

That works too.

Thanks.

I’ve manually made the change to the 3.0.x branch also… so it will appear in any new bug-fix releases on that branch, also.

1 Like