Resolves #517 NPE thrown by TalkgroupRangeEditor (#530)

This commit is contained in:
Denny Sheirer
2019-02-02 14:24:23 +00:00
committed by GitHub
parent 8cbdbd527e
commit ea472f873f
3 changed files with 28 additions and 2 deletions

View File

@@ -193,6 +193,11 @@ public class TalkgroupEditor extends DocumentListenerEditor<AliasID>
{
Protocol protocol = mComboProtocol.getItemAt(mComboProtocol.getSelectedIndex());
if(protocol == null)
{
protocol = Protocol.UNKNOWN;
}
int value = -1;
try

View File

@@ -83,6 +83,14 @@ public enum TalkgroupFormat
return mMaximumValue;
}
/**
* Indicates if the value is valid for the protocol
*/
public boolean isValid(int value)
{
return getMinimumValidValue() <= value && value <= getMaximumValidValue();
}
/**
* Short description of the valid value range
*/
@@ -99,9 +107,14 @@ public enum TalkgroupFormat
return mValidRangeHelpText;
}
public static TalkgroupFormat get(Protocol prococol)
public static TalkgroupFormat get(Protocol protocol)
{
switch(prococol)
if(protocol == null)
{
return UNKNOWN;
}
switch(protocol)
{
case APCO25:
return APCO25;

View File

@@ -174,6 +174,8 @@ public class TalkgroupRangeEditor extends DocumentListenerEditor<AliasID>
TalkgroupRange talkgroupRange = getTalkgroupRange();
updateEditor(talkgroupRange.getProtocol());
if(talkgroupRange != null)
{
mComboProtocol.getModel().setSelectedItem(talkgroupRange.getProtocol());
@@ -202,6 +204,12 @@ public class TalkgroupRangeEditor extends DocumentListenerEditor<AliasID>
if(talkgroupRange != null)
{
Protocol protocol = mComboProtocol.getItemAt(mComboProtocol.getSelectedIndex());
if(protocol == null)
{
protocol = Protocol.UNKNOWN;
}
talkgroupRange.setProtocol(protocol);
int minValue = -1;