aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2015-12-02 06:11:35 -0500
committerClyne Sullivan <tullivan99@gmail.com>2015-12-02 06:11:35 -0500
commit67ebafca971ecd4dcfde92bc64a838ba64c16e99 (patch)
tree047de504bb655358ded1f45770c91799aa1c4435 /src/ui.cpp
parent8426dc094bf9a0da94c01e46bb34d7d95ba21548 (diff)
segfault fixes
Diffstat (limited to 'src/ui.cpp')
-rw-r--r--src/ui.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/ui.cpp b/src/ui.cpp
index 8d57c36..a37a97c 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -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;
+
}
/*