From: Chakradhar Pogiri Date: Thu, 7 Oct 2021 12:22:54 +0000 (+0530) Subject: null checks added for battery monitor plugin X-Git-Tag: submit/tizen/20211008.061900^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff8e01959bb4d4c0177f89f364cda35a4bc945b3;p=platform%2Fcore%2Flocation%2Flbs-server.git null checks added for battery monitor plugin Change-Id: I58987a86e2d9115fe0d267d2049b2b6c9185e4f2 Signed-off-by: Chakradhar Pogiri --- diff --git a/lbs-server/src/battery-monitor/battery-monitor.c b/lbs-server/src/battery-monitor/battery-monitor.c index 67eb814..c7a942b 100755 --- a/lbs-server/src/battery-monitor/battery-monitor.c +++ b/lbs-server/src/battery-monitor/battery-monitor.c @@ -246,6 +246,10 @@ static void bm_batch_update_gps_record_on_gps_off() gpointer key, value; unsigned long elapsed = 0; + if (!ht_appstatus) { + _E("app status table is not initialized"); + return ; + } g_hash_table_iter_init (&iter, ht_appstatus); while (g_hash_table_iter_next(&iter, &key, &value)) { if(((const app_status*)value)->is_running) { @@ -268,6 +272,10 @@ static void bm_batch_update_gps_record_on_demand() gpointer key, value; unsigned long elapsed = 0; + if (!ht_appstatus) { + _E("app status table is not initialized"); + return ; + } g_hash_table_iter_init (&iter, ht_appstatus); while (g_hash_table_iter_next(&iter, &key, &value)) { if(((const app_status*)value)->is_running) { @@ -363,6 +371,10 @@ static void builder_add_atm_data(GVariantBuilder *atm_builder) GHashTableIter iter; gpointer key, value; + if (!ht_apptime) { + _E("battery-monitor module is not initialized"); + return ; + } g_hash_table_iter_init(&iter, ht_apptime); while (g_hash_table_iter_next(&iter, &key, &value)) { g_variant_builder_add(atm_builder, "(su)", (const char *)key, (*(unsigned int*)value)); @@ -391,6 +403,10 @@ static void gps_builder_update_gps_data(void) } /* if size(ht_apptime) is 0, there is no app that is using GPS */ + if (!ht_apptime) { + _E("battery-monitor module is not initialized"); + return ; + } if (g_hash_table_size(ht_apptime)) { t_start = timespec_to_ms(gps_session_start_t); t_end = timespec_to_ms(gps_session_end_t); diff --git a/packaging/lbs-server.spec b/packaging/lbs-server.spec index 8b1757c..838b49d 100755 --- a/packaging/lbs-server.spec +++ b/packaging/lbs-server.spec @@ -1,6 +1,6 @@ Name: lbs-server Summary: LBS Server for Tizen -Version: 1.3.7 +Version: 1.3.8 Release: 1 Group: Location/Service License: Apache-2.0