From 9cc7bc998bae9c53be1bff8e782fc25e3b67f621 Mon Sep 17 00:00:00 2001
From: "Eliel C. Sardanons" <eliels@gmail.com>
Date: Fri, 7 Nov 2008 03:02:01 +0000
Subject: [PATCH] If 'asterisk.conf' is not found, instead of giving up, load
 documentation for the 'en_US' language (fix my last commit).

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155204 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 main/pbx.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/main/pbx.c b/main/pbx.c
index 75134505bc..13d125e594 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -6546,19 +6546,16 @@ int ast_load_documentation(void)
 	/* setup default XML documentation language */
 	snprintf(documentation_language, sizeof(documentation_language), default_documentation_language);
 
-	if (!(cfg = ast_config_load2("asterisk.conf", "" /* core can't reload */, cnfflags))) {
-		ast_log(LOG_ERROR, "No asterisk.conf? That cannot be good.\n");
-		return 1;
-	}
-
-	for (var = ast_variable_browse(cfg, "options"); var; var = var->next) {
-		if (!strcasecmp(var->name, "documentation_language")) {
-			if (!ast_strlen_zero(var->value)) {
-				snprintf(documentation_language, sizeof(documentation_language), "%s", var->value);
+	if ((cfg = ast_config_load2("asterisk.conf", "" /* core can't reload */, cnfflags))) {
+		for (var = ast_variable_browse(cfg, "options"); var; var = var->next) {
+			if (!strcasecmp(var->name, "documentation_language")) {
+				if (!ast_strlen_zero(var->value)) {
+					snprintf(documentation_language, sizeof(documentation_language), "%s", var->value);
+				}
 			}
 		}
+		ast_config_destroy(cfg);
 	}
-        ast_config_destroy(cfg);
 
 	/* initialize the XML library. */
 	ast_xml_init();
-- 
GitLab