NPE when dragging immovable pieces from the palette

I was playing PoG yesterday and discovered that you get a NullPointerException
when you try to drag an immovable piece (e.g., a destroyed fort marker) from
the markers palette. It turns out that this problem had been reported several
times in automatically-generated bug reports, but without descriptions so I
could make neither heads nor tails of the stack traces.

Anyway, here’s what the problem was: Brent’s fix which prevented selected
immovable tokens from being dragged along with movable ones was a bit
overbroad. It filtered out all immovable tokens from the drag, which made
the drag list empty if you were dragging an immovable piece from the palette.

Brent, have a look at uckelman-cur@4056. It’s a one-line change, I’m just
checking additionally that any piece being discarded from the drag also
has a nonnull Map (which pieces dragged from the palette don’t). This seems
to work in the situation I tested it, but I’m not sure if this is ok in all
situations.

(I find myself wondering this pretty frequently. It makes me think that
maybe we should be writing unit tests?)

Joel,

Yes, that looks good.

B.


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

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Brent Easton”:

Merged to trunk@4058.


J.


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

Post generated using Mail2Forum (mail2forum.com)