Fix static analysis issues 63/313863/2
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 2 Jul 2024 23:48:21 +0000 (08:48 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 3 Jul 2024 03:31:41 +0000 (12:31 +0900)
Checker:
 - DEREF_OF_NULL

Change-Id: I715ecc12e7a65e866e64bdf229eb2da3a029feea
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/modules/widget/src/amd_widget.c

index 6cdded7ded223dfb7d4b35881738b219a037465b..5a97d0d2b78b5c88dac24246771333f09bbc9b3d 100644 (file)
@@ -1321,7 +1321,18 @@ static int __dispatch_widget_disable(amd_request_h req)
        }
 
        bundle_get_str(kb, AUL_K_WIDGET_ID, &widget_id);
+       if (!widget_id) {
+               LOGE("Failed to get widget id");
+               amd_request_send_result(req, -EINVAL);
+               return -1;
+       }
+
        bundle_get_str(kb, AUL_K_WIDGET_DISABLE, &ambient);
+       if (!ambient || !isdigit(ambient[0])) {
+               LOGE("Failed to get ambient");
+               amd_request_send_result(req, -EINVAL);
+               return -1;
+       }
 
        ret = aul_widget_service_set_usr_disable_db(widget_id,
                        (bool)atoi(ambient), sender_uid);