From: Adam Dickmeiss Date: Wed, 26 Aug 2015 09:55:18 +0000 (+0200) Subject: Fix pazpar2 crash when using pz:extendrecs PAZ-1024 X-Git-Tag: v1.12.1~1 X-Git-Url: http://jira.indexdata.com/?a=commitdiff_plain;h=b1e45fa9dbe4e097133b80d58b45b6e146ed50ba;p=pazpar2-moved-to-github.git Fix pazpar2 crash when using pz:extendrecs PAZ-1024 --- diff --git a/src/client.c b/src/client.c index 75a8e20..267527c 100644 --- a/src/client.c +++ b/src/client.c @@ -825,6 +825,7 @@ int client_fetch_more(struct client *cl) const char *str; int extend_recs = 0; int number = cl->hits - cl->record_offset; + struct connection *co = client_get_connection(cl); str = session_setting_oneval(sdb, PZ_EXTENDRECS); if (!str || !*str) @@ -840,10 +841,13 @@ int client_fetch_more(struct client *cl) if (number > extend_recs) number = extend_recs; - if (number > 0) + if (number <= 0) + yaz_log(YLOG_LOG, "cl=%s. OK no more in total set", client_get_id(cl)); + else if (!co) + yaz_log(YLOG_LOG, "cl=%s. No connection", client_get_id(cl)); + else { ZOOM_resultset set = cl->resultset; - struct connection *co = client_get_connection(cl); str = session_setting_oneval(sdb, PZ_REQUESTSYNTAX); ZOOM_resultset_option_set(set, "preferredRecordSyntax", str); @@ -856,10 +860,6 @@ int client_fetch_more(struct client *cl) connection_continue(co); return 1; } - else - { - yaz_log(YLOG_LOG, "cl=%s. OK no more in total set", client_get_id(cl)); - } return 0; }