--- plugins/menu.plugin/menu.plugin.c
+++ plugins/menu.plugin/menu.plugin.c
@@ -23,6 +23,18 @@
 #include "menu.h"
 #include "config.h"
 
+plugin_exec_cmd dtmfbox = NULL;
+
+/* Defeat compiler optimization which assumes function addresses are never NULL */
+int not_null_ptr(const void *p) {
+    const void *q;
+    __asm__ (""
+        : "=r" (q) /* output */
+        : "0" (p) /* input */
+    );
+    return q != 0;
+}
+
 /* Callback gets called when a new event arrives */
 EXPORT void plugin_event(char *scriptfile, char *s_event, char *s_direction, char *s_type, int conid_src, int conid_dst, char *no_src, char *no_dst, char *data, int acc_id) 
 {   
--- plugins/menu.plugin/menu.plugin.h
+++ plugins/menu.plugin/menu.plugin.h
@@ -57,11 +57,13 @@
 __EXTERN menu_t **menus;                       // Menues 
 __EXTERN unsigned menu_count;                  // Menu count
 
-#define app_msg(x)  dtmfbox(2, "-log1", x)     // Logging
-#define app_err(x)  dtmfbox(2, "-log2", x)
-#define app_dbg(x)  dtmfbox(2, "-log3", x)
-#define app_dbg2(x) dtmfbox(2, "-log4", x)
-#define app_dbg3(x) dtmfbox(2, "-log5", x)
+int not_null_ptr(const void *p);
+
+#define app_msg(x)  { if (not_null_ptr(dtmfbox)) dtmfbox(2, "-log1", x); }     // Logging
+#define app_err(x)  { if (not_null_ptr(dtmfbox)) dtmfbox(2, "-log2", x); }
+#define app_dbg(x)  { if (not_null_ptr(dtmfbox)) dtmfbox(2, "-log3", x); }
+#define app_dbg2(x) { if (not_null_ptr(dtmfbox)) dtmfbox(2, "-log4", x); }
+#define app_dbg3(x) { if (not_null_ptr(dtmfbox)) dtmfbox(2, "-log5", x); }
 
 #ifdef __cplusplus
 extern "C" {
