[hue] Eliminate NPE in #9985 (#10199)

* [hue] extra null check

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
pull/10202/head
Andrew Fiddian-Green 2021-02-19 19:16:26 +00:00 committed by GitHub
parent 1c5f0d1797
commit a9f440dba2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -119,9 +119,11 @@ public class HueBridgeDiscoveryParticipant implements UpnpDiscoveryParticipant {
try {
Configuration conf = configAdmin.getConfiguration("binding.hue");
Dictionary<String, @Nullable Object> properties = conf.getProperties();
Object property = properties.get(HueBindingConstants.REMOVAL_GRACE_PERIOD);
if (property != null) {
removalGracePeriodSeconds = Long.parseLong(property.toString());
if (properties != null) {
Object property = properties.get(HueBindingConstants.REMOVAL_GRACE_PERIOD);
if (property != null) {
removalGracePeriodSeconds = Long.parseLong(property.toString());
}
}
} catch (IOException | IllegalStateException | NumberFormatException e) {
// fall through to pre-initialised (default) value