diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-07-27 17:58:14 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-07-27 17:58:14 +0200 |
commit | e9ddf0e9a82e12c3d4d384f9a8f321b3f409b997 (patch) | |
tree | 4e59034fe9d85d508f1c8910ea15b12d75735354 | |
parent | 372ec549a7a5773602512c961fccc5c139d53d47 (diff) |
firebase: Don't do anything when not initialised
-rw-r--r-- | firebase.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -133,11 +133,17 @@ void firebase_init(void){ } void firebase_stop(void){ - // Script will stop itself on EOF on stdin - fclose(js_write); + if(js_write){ + // Script will stop itself on EOF on stdin + fclose(js_write); + js_write=NULL; + } } void firebase_send_message(const char *room,i64 roomid,const char *user,const char *msg){ + // If not initialised, do nothing + if(!js_write)return; + if(roomid==-1)roomid=db_find_room(room); if(roomid==-1){ debug("firebase_send_message: Cannot find roomid for room '%s'",room); |