Fixed the memorable match seg fault, bug 2857927

This commit is contained in:
gunnar_g 2010-04-12 11:28:32 +00:00
parent 7f648bd764
commit c3bbc78a4c
1 changed files with 5 additions and 1 deletions

View File

@ -1145,7 +1145,7 @@ user_mm_load_file(const gchar *filename, GArray *mmatches)
GString *prefix = g_string_new("");
gchar filename_local[SMALL],
matches_file[SMALL];
GArray *mm_array = (mmatches == NULL) ?
GArray *mm_array = (mmatches != NULL) ?
current_user.mmatches : mmatches;
strcpy(filename_local, filename);
@ -1157,7 +1157,10 @@ user_mm_load_file(const gchar *filename, GArray *mmatches)
file_decompress(filename_local);
if(mmatches == NULL)
{
free_mmatches(&mm_array, TRUE);
mm_array = g_array_new(FALSE, FALSE, sizeof(MemMatch));
}
xml_mmatches_read(matches_file, mm_array);
@ -1168,6 +1171,7 @@ user_mm_load_file(const gchar *filename, GArray *mmatches)
misc_string_assign(&current_user.mmatches_file, filename_local);
g_string_free(prefix, TRUE);
current_user.mmatches = mm_array;
}
/** Add the last match to the MM file.