diff options
-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); |