Browse Source

Check for non-null pointers

Serj Kalichev 10 years ago
parent
commit
6312193a6f
2 changed files with 4 additions and 1 deletions
  1. 3 0
      clish/shell/shell_var.c
  2. 1 1
      clish/shell/shell_xml.c

+ 3 - 0
clish/shell/shell_var.c

@@ -51,6 +51,9 @@ static char *find_context_var(const char *name, clish_context_t *this)
 	char *result = NULL;
 	clish_shell_t *shell = this->shell;
 
+	if (!shell || !shell->tinyrl)
+		return NULL;
+
 	if (!lub_string_nocasecmp(name, "_width")) {
 		char tmp[5];
 		snprintf(tmp, sizeof(tmp), "%u",

+ 1 - 1
clish/shell/shell_xml.c

@@ -300,7 +300,7 @@ static void process_overview(clish_shell_t *shell, clish_xmlnode_t *element,
 		if (!new) {
 			if (content)
 				free(content);
-			return -1;
+			return;
 		}
 		content = new;
 		result = clish_xmlnode_get_content(element, content,