gsmtap: deal with apps that call gsmtap_send*() with NULL gsmtap_inst
diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c
index 5c68b6a..3d20bfc 100644
--- a/src/gsmtap_util.c
+++ b/src/gsmtap_util.c
@@ -148,6 +148,9 @@
 
 int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg)
 {
+	if (!gti)
+		return -ENODEV;
+
 	if (gti->ofd_wq_mode)
 		return osmo_wqueue_enqueue(&gti->wq, msg);
 	else {
@@ -175,6 +178,9 @@
 {
 	struct msgb *msg;
 
+	if (!gti)
+		return -ENODEV;
+
 	msg = gsmtap_makemsg(arfcn, ts, chan_type, ss, fn, signal_dbm,
 			     snr, data, len);
 	if (!msg)