[miio] Check for null properties (#9408)
Signed-off-by: Mark Hilbush <mark@hilbush.com>
This commit is contained in:
parent
a7009101ba
commit
74bdcb6e85
|
@ -95,12 +95,17 @@ public class MiIoDiscovery extends AbstractDiscoveryService {
|
||||||
if (miioConfig != null) {
|
if (miioConfig != null) {
|
||||||
try {
|
try {
|
||||||
Dictionary<String, @Nullable Object> properties = miioConfig.getProperties();
|
Dictionary<String, @Nullable Object> properties = miioConfig.getProperties();
|
||||||
String cloudDiscoveryModeConfig = (String) properties.get("cloudDiscoveryMode");
|
String cloudDiscoveryModeConfig;
|
||||||
|
if (properties == null) {
|
||||||
|
cloudDiscoveryModeConfig = DISABLED;
|
||||||
|
} else {
|
||||||
|
cloudDiscoveryModeConfig = (String) properties.get("cloudDiscoveryMode");
|
||||||
if (cloudDiscoveryModeConfig == null) {
|
if (cloudDiscoveryModeConfig == null) {
|
||||||
cloudDiscoveryModeConfig = DISABLED;
|
cloudDiscoveryModeConfig = DISABLED;
|
||||||
} else {
|
} else {
|
||||||
cloudDiscoveryModeConfig = cloudDiscoveryModeConfig.toLowerCase();
|
cloudDiscoveryModeConfig = cloudDiscoveryModeConfig.toLowerCase();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return Set.of(SUPPORTED, ALL).contains(cloudDiscoveryModeConfig) ? cloudDiscoveryModeConfig : DISABLED;
|
return Set.of(SUPPORTED, ALL).contains(cloudDiscoveryModeConfig) ? cloudDiscoveryModeConfig : DISABLED;
|
||||||
} catch (ClassCastException | SecurityException e) {
|
} catch (ClassCastException | SecurityException e) {
|
||||||
logger.debug("Error getting cloud discovery configuration: {}", e.getMessage());
|
logger.debug("Error getting cloud discovery configuration: {}", e.getMessage());
|
||||||
|
|
Loading…
Reference in New Issue