From 7b8923a6bc228fee37189a6ce99934ad2976807d Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Thu, 22 Oct 2015 17:46:39 +0300
Subject: Fix crash in instance.c

---
 src/map/instance.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src')

diff --git a/src/map/instance.c b/src/map/instance.c
index 545ffe1e7..45e407dfc 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -94,9 +94,9 @@ int instance_create(int owner_id, const char *name, enum instance_owner_type typ
 	}
 
 	if( type != IOT_NONE && *icptr ) {
-		ARR_FIND(0, *icptr, i, strcmp(instance->list[iptr[i]].name,name) == 0 );
+		ARR_FIND(0, *icptr, i, iptr[i] != -1 && strcmp(instance->list[iptr[i]].name, name) == 0 );
 		if( i != *icptr )
-			return -4;/* already got this instance */
+			return -4; /* already got this instance */
 	}
 
 	ARR_FIND(0, instance->instances, i, instance->list[i].state == INSTANCE_FREE);
-- 
cgit v1.2.3-70-g09d2