diff --git a/html/script.js b/html/script.js
index d3fcb2e..c1a99fd 100644
--- a/html/script.js
+++ b/html/script.js
@@ -70,7 +70,7 @@ Keypad.Open = function(data) {
Keypad.Close = function(data) {
$("#keypad").css("display", "none");
$.post(`https://${GetParentResourceName()}/PadLockClose`);
- if (data.error) {
+ if (data?.error) {
$.post(`https://${GetParentResourceName()}/CombinationFail`);
}
}