diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2015-12-02 06:11:35 -0500 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2015-12-02 06:11:35 -0500 |
commit | 67ebafca971ecd4dcfde92bc64a838ba64c16e99 (patch) | |
tree | 047de504bb655358ded1f45770c91799aa1c4435 /src/ui.cpp | |
parent | 8426dc094bf9a0da94c01e46bb34d7d95ba21548 (diff) |
segfault fixes
Diffstat (limited to 'src/ui.cpp')
-rw-r--r-- | src/ui.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -398,20 +398,30 @@ namespace ui { */ while(dialogOptCount){ - if(dialogOptText[dialogOptCount]) + if(dialogOptText[dialogOptCount]){ delete[] dialogOptText[dialogOptCount]; //free(dialogOptText[dialogOptCount]); + dialogOptText[dialogOptCount] = NULL; + } dialogOptCount--; }; + dialogOptChosen=0; dialogOptCount=0; - soptbuf = new char[strlen(opt)+1]; - - sopt=strtok(soptbuf,":"); - while(sopt != NULL){ - dialogOptText[dialogOptCount] = new char[strlen(sopt)+1]; //(char *)malloc(strlen(sopt)); - strcpy(dialogOptText[dialogOptCount++],sopt); - sopt=strtok(NULL,":"); + if(opt){ + + soptbuf = new char[strlen(opt)+1]; + strcpy(soptbuf,opt); + + sopt=strtok(soptbuf,":"); + while(sopt != NULL){ + dialogOptText[dialogOptCount] = new char[strlen(sopt)+1]; //(char *)malloc(strlen(sopt)); + strcpy(dialogOptText[dialogOptCount++],sopt); + sopt=strtok(NULL,":"); + } + + delete[] soptbuf; + } /* |