From 8637f6e4e93692ccee444025ce8193fc11113507 Mon Sep 17 00:00:00 2001 From: flowtron Date: Fri, 6 Aug 2010 23:21:20 +0000 Subject: [PATCH] avoid crashing on empty input .. "Duh!" git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5547 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/entities.cpp | 53 ++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/source/src/entities.cpp b/source/src/entities.cpp index 8604dd46..cbd1b256 100644 --- a/source/src/entities.cpp +++ b/source/src/entities.cpp @@ -79,37 +79,42 @@ COMMAND(showedithide, ARG_NONE); void setedithide(char *text) // FIXME: human indexing inside { - //int lop = 0; eh_ents.setsize(0); - const char *s = strtok(text, " "); - do - { - bool k = false; - int sn = -1; - int tn = atoi(s); - loopi(MAXENTTYPES) if(!strcmp(entnames[i], s)) sn = i; - if(sn!=-1) { loopv(eh_ents) { if(eh_ents[i]==sn) { k = true; } } } - else sn = tn; - if(!k) { if(sn>0 && sn0 && sn