From 92c6f3abc5021ffc7e455373ea9a5069caf58009 Mon Sep 17 00:00:00 2001
From: Michael Jerris <mike@jerris.com>
Date: Thu, 15 May 2014 13:37:26 +0000
Subject: [PATCH] CID:1214192 Dereference after null check, don't crash when no
 file name passed on file open

---
 src/mod/applications/mod_httapi/mod_httapi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c
index b33a7ef7fe..3c549c60e0 100644
--- a/src/mod/applications/mod_httapi/mod_httapi.c
+++ b/src/mod/applications/mod_httapi/mod_httapi.c
@@ -2828,6 +2828,11 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *path,
 			}	
 		}
 
+		if (!context->write.file_name) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No file name specified.\n");
+			return SWITCH_STATUS_GENERR;
+		}
+
 		if ((ext = strrchr(context->write.file_name, '.'))) {
 			ext++;
 		} else {