Browse Source

Check for NULL in get_arg()

Serj Kalichev 10 years ago
parent
commit
8ce8c98843
1 changed files with 3 additions and 1 deletions
  1. 3 1
      lub/argv/argv__get_arg.c

+ 3 - 1
lub/argv/argv__get_arg.c

@@ -4,10 +4,12 @@
 #include "private.h"
 
 /*--------------------------------------------------------- */
-const char *lub_argv__get_arg(const lub_argv_t * this, unsigned index)
+const char *lub_argv__get_arg(const lub_argv_t *this, unsigned int index)
 {
 	const char *result = NULL;
 
+	if (!this)
+		return NULL;
 	if (this->argc > index)
 		result = this->argv[index].arg;