Skip to content

Commit 8710ddc

Browse files
Fix NullPointerException.
Signed-off-by: Adrián Boimvaser <adrianboimvaser@gmail.com>
1 parent 222f146 commit 8710ddc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/org/openhab/binding/zwave/internal/ZWaveConfigProvider.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,14 +290,16 @@ public ConfigDescription getConfigDescription(URI uri, Locale locale) {
290290

291291
for (int code = 1; code <= userCodeClass.getNumberOfSupportedCodes(); code++) {
292292
UserCode userCode = userCodeClass.getCachedUserCode(code);
293+
boolean readOnly =
294+
userCode != null && userCode.getState() == UserIdStatusType.RESERVED_BY_ADMINISTRATOR;
293295
parameters.add(ConfigDescriptionParameterBuilder
294296
.create(ZWaveBindingConstants.CONFIGURATION_USERCODE_LABEL + code, Type.TEXT)
295297
.withLabel("Code " + code + " Label").withDescription("Name for user code " + code)
296298
.withGroupName("usercode").build());
297299
parameters.add(ConfigDescriptionParameterBuilder
298300
.create(ZWaveBindingConstants.CONFIGURATION_USERCODE_CODE + code, Type.TEXT)
299301
.withLabel("Code " + code).withDescription("Set the user code (4 to 10 numbers)")
300-
.withReadOnly(userCode.getState() == UserIdStatusType.RESERVED_BY_ADMINISTRATOR)
302+
.withReadOnly(readOnly)
301303
.withGroupName("usercode").build());
302304
}
303305
}

0 commit comments

Comments
 (0)