mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[unifi] Fix NullPointerException
(#17421)
* Fix NPE * Null warning Signed-off-by: Leo Siepel <leosiepel@gmail.com>
This commit is contained in:
parent
600ca69c94
commit
2f6db504c9
@ -89,7 +89,8 @@ public class UniFiPoePortThingHandler extends UniFiBaseThingHandler<UniFiSwitchP
|
|||||||
} else {
|
} else {
|
||||||
final String channelConfigPoeEnableMode = (String) channel.getConfiguration()
|
final String channelConfigPoeEnableMode = (String) channel.getConfiguration()
|
||||||
.get(CHANNEL_ENABLE_PARAMETER_MODE);
|
.get(CHANNEL_ENABLE_PARAMETER_MODE);
|
||||||
poeEnableMode = channelConfigPoeEnableMode.isBlank() ? CHANNEL_ENABLE_PARAMETER_MODE_AUTO
|
poeEnableMode = channelConfigPoeEnableMode == null || channelConfigPoeEnableMode.isBlank()
|
||||||
|
? CHANNEL_ENABLE_PARAMETER_MODE_AUTO
|
||||||
: channelConfigPoeEnableMode;
|
: channelConfigPoeEnableMode;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -139,7 +140,7 @@ public class UniFiPoePortThingHandler extends UniFiBaseThingHandler<UniFiSwitchP
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
private <Q extends Quantity<Q>> State safeDouble(final String value, final Unit<Q> unit) {
|
private <Q extends Quantity<Q>> State safeDouble(@Nullable final String value, final Unit<Q> unit) {
|
||||||
try {
|
try {
|
||||||
return value == null ? UnDefType.UNDEF : QuantityType.valueOf(Double.parseDouble(value), unit);
|
return value == null ? UnDefType.UNDEF : QuantityType.valueOf(Double.parseDouble(value), unit);
|
||||||
} catch (final NumberFormatException e) {
|
} catch (final NumberFormatException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user