36 lines
1011 B
Diff
36 lines
1011 B
Diff
From c642d0efb5606101b8ea0d30b95cb1b47af05e1d Mon Sep 17 00:00:00 2001
|
|
From: bizhiyuan <bizhiyuan@kylinos.cn>
|
|
Date: Tue, 17 Oct 2023 17:31:21 +0800
|
|
Subject: [PATCH] Fix glib hash_table is not NULL assert
|
|
|
|
---
|
|
src/attr.c | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/src/attr.c b/src/attr.c
|
|
index 09c15bc..5f057ae 100644
|
|
--- a/src/attr.c
|
|
+++ b/src/attr.c
|
|
@@ -357,6 +357,8 @@ static cmd_result_t attr_get(struct ticket_config *tk, int fd, struct boothc_att
|
|
* lookup attr
|
|
* send value
|
|
*/
|
|
+ if (!tk->attr)
|
|
+ return RLT_NO_SUCH_ATTR;
|
|
|
|
a = (struct geo_attr *)g_hash_table_lookup(tk->attr, msg->attr.name);
|
|
if (!a)
|
|
@@ -392,6 +394,9 @@ static cmd_result_t attr_list(struct ticket_config *tk, int fd, struct boothc_at
|
|
return RLT_SYNC_FAIL;
|
|
}
|
|
g_hash_table_foreach(tk->attr, append_attr, data);
|
|
+ if (tk->attr) {
|
|
+ g_hash_table_foreach(tk->attr, append_attr, data);
|
|
+ }
|
|
|
|
init_header(&hdr.header, ATTR_LIST, 0, 0, RLT_SUCCESS, 0,
|
|
sizeof(hdr) + data->len);
|
|
--
|
|
2.27.0
|
|
|