NPE in NPE in RemovePiece.executeCommand() (Bug 2078197)

I’m trying to work out a fix for Bug 2078197 right now, which is an
NullPointerException in RemovePiece.executeCommand() on line 56 where
we call Map.getIdentifier().

What I don’t understand about the code here is that we call
m.getIdentifier() but throw away the return value, and so far as I can
see Map.getIdentifier() has no side-effects. It appears that RemovePiece
has been like this since r451, so if it’s this way accidentally, it’s been
like this for four years. There must have been some point to this line,
so I’m loath to simply remove it without understanding why it was put there
in the first place.

It sure looks like there are no side effects to this call. I’d say you can safely delete it. My best guess is that it was put in to ensure that the map had been assigned an id (so that the undo command, or perhaps the command encoding, would be well-formed) back when ids were dynamically allocated.

rk

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Rodney Kinney”:

Fixed in trunk@4097.

J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)