Fix a bug about getting component info 25/211925/2
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 12 Aug 2019 05:52:13 +0000 (14:52 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 12 Aug 2019 06:05:22 +0000 (15:05 +0900)
Change-Id: I9ce6be6398c0b5e52345a2738bdb16f2fb26c5f8
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/aul_comp_info_internal.c

index 76acd7f..711512e 100644 (file)
@@ -212,6 +212,7 @@ static int __create_compinfo(const char *comp_id, uid_t uid,
        sqlite3 *db;
        char *query;
        char *db_path;
+       int value_idx;
        int idx;
        struct aul_compinfo_s *info;
        int ret;
@@ -270,11 +271,9 @@ static int __create_compinfo(const char *comp_id, uid_t uid,
                goto end;
        }
 
-       for (idx = AUL_COMPINFO_START; idx < AUL_COMPINFO_MAX; idx++) {
-               if (idx == AUL_COMPINFO_COMP_ID)
-                       continue;
-
-               ret = __save_column_str(stmt, idx, &info->value[idx]);
+       for (idx = AUL_COMPINFO_START; idx < AUL_COMPINFO_MAX - 1; idx++) {
+               value_idx = (idx < AUL_COMPINFO_COMP_ID) ? idx : idx + 1;
+               ret = __save_column_str(stmt, idx, &info->value[value_idx]);
                if (ret != AUL_R_OK) {
                        __destroy_compinfo(info);
                        goto end;