Просмотр исходного кода

fix(entity): json.decode can raise TypeError

When decoding json attributes, if the value is null or a non-string value, json.decode
raises TypeError rather than JSONDecodeError.

Issue #6352
Jason Rumney 3 дней назад
Родитель
Сommit
cbe214cbf6
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      custom_components/tuya_local/entity.py

+ 1 - 1
custom_components/tuya_local/entity.py

@@ -107,7 +107,7 @@ class TuyaLocalEntity:
                 if a.rawtype == "json":
                     try:
                         value = json.loads(value)
-                    except json.JSONDecodeError:
+                    except json.JSONDecodeError, TypeError:
                         if value is not None:
                             _LOGGER.warning(
                                 "Failed to decode JSON for attribute %s: %s",