fixed crash at save mode getting

pull/30/head
parent f1fa562991
commit 3bc19ea3ab

@ -579,30 +579,34 @@ template_main_window *setup_window(){
if (yon_char_is_empty(__yon_config_mode)){ if (yon_char_is_empty(__yon_config_mode)){
int size; int size;
config_str cnf = yon_config_load(SAVE_MODE_GET_COMMAND,&size); config_str cnf = yon_config_load(SAVE_MODE_GET_COMMAND,&size);
__yon_config_mode=yon_char_new(cnf[0]); if (cnf){
if (__yon_config_mode[strlen(__yon_config_mode)-1]=='\n') __yon_config_mode[strlen(__yon_config_mode)-1]='\0'; __yon_config_mode=yon_char_new(cnf[0]);
yon_char_parsed_free(cnf,size); if (__yon_config_mode[strlen(__yon_config_mode)-1]=='\n') __yon_config_mode[strlen(__yon_config_mode)-1]='\0';
if (!yon_char_is_empty(__yon_config_mode)&&strcmp(__yon_config_mode,"(null)")){ yon_char_parsed_free(cnf,size);
gtk_image_set_from_pixbuf(GTK_IMAGE(ModeStatusImage),gtk_icon_theme_load_icon_for_scale(gtk_icon_theme_get_default(),yon_ubl_save_mode_get_icon_name(yon_ubl_save_mode_get_type(__yon_config_mode)),25,1,GTK_ICON_LOOKUP_FORCE_SIZE,NULL)); if (!yon_char_is_empty(__yon_config_mode)&&strcmp(__yon_config_mode,"(null)")){
char *tooltip_text=NULL; gtk_image_set_from_pixbuf(GTK_IMAGE(ModeStatusImage),gtk_icon_theme_load_icon_for_scale(gtk_icon_theme_get_default(),yon_ubl_save_mode_get_icon_name(yon_ubl_save_mode_get_type(__yon_config_mode)),25,1,GTK_ICON_LOOKUP_FORCE_SIZE,NULL));
switch (yon_ubl_save_mode_get_type(__yon_config_mode)){ char *tooltip_text=NULL;
case SAVE_MODE_FULL: tooltip_text = SAVE_MODE_FULL_LABEL; switch (yon_ubl_save_mode_get_type(__yon_config_mode)){
break; case SAVE_MODE_FULL: tooltip_text = SAVE_MODE_FULL_LABEL;
case SAVE_MODE_MODULE: tooltip_text = SAVE_MODE_MODULE_LABEL; break;
break; case SAVE_MODE_MODULE: tooltip_text = SAVE_MODE_MODULE_LABEL;
case SAVE_MODE_SANDBOX: tooltip_text = SAVE_MODE_SANDBOX_LABEL; break;
break; case SAVE_MODE_SANDBOX: tooltip_text = SAVE_MODE_SANDBOX_LABEL;
case SAVE_MODE_RAM_HOME: tooltip_text = SAVE_MODE_RAM_HOME_LABEL; break;
break; case SAVE_MODE_RAM_HOME: tooltip_text = SAVE_MODE_RAM_HOME_LABEL;
case SAVE_MODE_HDD: tooltip_text = SAVE_MODE_HDD_LABEL; break;
break; case SAVE_MODE_HDD: tooltip_text = SAVE_MODE_HDD_LABEL;
case SAVE_MODE_HDD_HOME: tooltip_text = SAVE_MODE_HDD_HOME_LABEL; break;
break; case SAVE_MODE_HDD_HOME: tooltip_text = SAVE_MODE_HDD_HOME_LABEL;
break;
}
gtk_widget_set_tooltip_text(ModeStatusImage,tooltip_text);
} else {
free(__yon_config_mode);
__yon_config_mode=NULL;
gtk_widget_hide(ModeStatusImage);
} }
gtk_widget_set_tooltip_text(ModeStatusImage,tooltip_text);
} else { } else {
free(__yon_config_mode);
__yon_config_mode=NULL;
gtk_widget_hide(ModeStatusImage); gtk_widget_hide(ModeStatusImage);
} }
} }

Loading…
Cancel
Save