mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +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 {
|
||||
final String channelConfigPoeEnableMode = (String) channel.getConfiguration()
|
||||
.get(CHANNEL_ENABLE_PARAMETER_MODE);
|
||||
poeEnableMode = channelConfigPoeEnableMode.isBlank() ? CHANNEL_ENABLE_PARAMETER_MODE_AUTO
|
||||
poeEnableMode = channelConfigPoeEnableMode == null || channelConfigPoeEnableMode.isBlank()
|
||||
? CHANNEL_ENABLE_PARAMETER_MODE_AUTO
|
||||
: channelConfigPoeEnableMode;
|
||||
return true;
|
||||
}
|
||||
@ -139,7 +140,7 @@ public class UniFiPoePortThingHandler extends UniFiBaseThingHandler<UniFiSwitchP
|
||||
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 {
|
||||
return value == null ? UnDefType.UNDEF : QuantityType.valueOf(Double.parseDouble(value), unit);
|
||||
} catch (final NumberFormatException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user