Skip to content

Commit c1e6810

Browse files
committed
Null handle
Signed-off-by: mohitkhullar <[email protected]>
1 parent 9183f85 commit c1e6810

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cdb2api/cdb2api.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,8 @@ static int is_api_call_timedout(cdb2_hndl_tp *hndl) {
870870
}
871871

872872
static long long get_call_timeout(const cdb2_hndl_tp *hndl, long long timeout) {
873+
if (!hndl)
874+
return timeout;
873875
struct timeval tv;
874876
gettimeofday(&tv, NULL);
875877
long long current_time = tv.tv_sec*1000 + tv.tv_usec/1000;
@@ -884,7 +886,8 @@ static long long get_call_timeout(const cdb2_hndl_tp *hndl, long long timeout) {
884886
static void set_max_call_time(cdb2_hndl_tp *hndl) {
885887
struct timeval tv;
886888
gettimeofday(&tv, NULL);
887-
hndl->max_call_time = tv.tv_sec*1000 + tv.tv_usec/1000 + hndl->api_call_timeout;
889+
if (hndl)
890+
hndl->max_call_time = tv.tv_sec*1000 + tv.tv_usec/1000 + hndl->api_call_timeout;
888891
}
889892

890893
enum {

0 commit comments

Comments
 (0)