Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed issue #121: possible NPE when changing color of non-digital sig…

…nals.
  • Loading branch information...
commit b57af97fd4018ecd5fa1dd940f4649458212b107 1 parent 9826bab
@jawi authored
View
9 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/signalelement/SignalElement.java
@@ -684,8 +684,13 @@ final void setYposition( final int aYPosition )
private String getColorKey()
{
Integer groupIdx = Integer.valueOf( ( this.group.getIndex() % 4 ) + 1 );
- Integer channelIdx = Integer.valueOf( ( this.channel.getIndex() % 8 ) + 1 );
- return String.format( "ols.channelgroup%d.channel%d.default.color", groupIdx, channelIdx );
+ // Issue #121: channel can be null for non-digital channels...
+ if ( this.channel != null )
+ {
+ Integer channelIdx = Integer.valueOf( ( this.channel.getIndex() % 8 ) + 1 );
+ return String.format( "ols.channelgroup%d.channel%d.default.color", groupIdx, channelIdx );
+ }
+ return String.format( "ols.channelgroup%d.default.color", groupIdx );
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.