aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-07-27 17:58:14 +0200
committerTom Smeding <tom.smeding@gmail.com>2020-07-27 17:58:14 +0200
commite9ddf0e9a82e12c3d4d384f9a8f321b3f409b997 (patch)
tree4e59034fe9d85d508f1c8910ea15b12d75735354
parent372ec549a7a5773602512c961fccc5c139d53d47 (diff)
firebase: Don't do anything when not initialised
-rw-r--r--firebase.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/firebase.c b/firebase.c
index 641dafe..bc9d5ae 100644
--- a/firebase.c
+++ b/firebase.c
@@ -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);