Skip to content

Commit

Permalink
Merge pull request #5936 from Sleet01/Fix_5903_NPE_when_switching_uni…
Browse files Browse the repository at this point in the history
…ts_during_deployment

Fix #5903 with a null check before dereferencing Coords cp
  • Loading branch information
Sleet01 authored Aug 21, 2024
2 parents 56f5170 + 7e11fae commit c978b30
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions megamek/src/megamek/client/ui/swing/boardview/BoardView.java
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,9 @@ private synchronized void drawHexSpritesForHex(Coords c, Graphics g,

for (HexSprite sprite : spriteArrayList) {
Coords cp = sprite.getPosition();
if (cp == null) {
continue;
}
// This can potentially be an expensive operation
Rectangle spriteBounds = sprite.getBounds();
if (cp.equals(c) && view.intersects(spriteBounds) && !sprite.isHidden()) {
Expand Down

0 comments on commit c978b30

Please sign in to comment.