From 671f900225f89794db9b6404108fe648a017f43a Mon Sep 17 00:00:00 2001
From: Matthew Jordan <mjordan@digium.com>
Date: Wed, 8 May 2013 18:36:21 +0000
Subject: [PATCH] Don't perform a realtime lookup with a NULL keyword

Previously, a call to ast_load_realtime_multientry could get away with
passing a NULL parameter to the function, even though it really isn't
supposed to do that. After the change over to using ast_variable instead
of variadic arguments, the realtime engine gets unhappy if you do this.

This was always an unintended function call in app_directory anyway - now,
we just don't call into the realtime function calls if we don't have anything
to query on.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388008 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 apps/app_directory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/apps/app_directory.c b/apps/app_directory.c
index b26a09cd97..edfc349ea7 100644
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -440,7 +440,7 @@ AST_THREADSTORAGE(commonbuf);
 static struct ast_config *realtime_directory(char *context)
 {
 	struct ast_config *cfg;
-	struct ast_config *rtdata;
+	struct ast_config *rtdata = NULL;
 	struct ast_category *cat;
 	struct ast_variable *var;
 	char *mailbox;
@@ -475,7 +475,7 @@ static struct ast_config *realtime_directory(char *context)
 			rtdata = ast_load_realtime_multientry("voicemail", "mailbox LIKE", "%", "context", "default", SENTINEL);
 			context = "default";
 		}
-	} else {
+	} else if (!ast_strlen_zero(context)) {
 		rtdata = ast_load_realtime_multientry("voicemail", "mailbox LIKE", "%", "context", context, SENTINEL);
 	}
 
-- 
GitLab