More fixes

This commit is contained in:
hippydave 2019-07-09 16:37:23 +01:00
parent 04d7e24565
commit 722d9b98af
3 changed files with 6 additions and 4 deletions

View File

@ -494,8 +494,7 @@ bool menuEntryLoad(menuEntry_s* me, const char* name, bool shortcut) {
strptr = getSlash(me->path);
if (strptr[0] == '/') strptr++;
int strptrLen = strlen(strptr);
snprintf(tempbuf, sizeof(tempbuf)-1, "%.*s.%.*s.star", (int)(strlen(me->path) - strptrLen), me->path, (int)strptrLen, strptr);
strcpy(me->starpath, tempbuf);
snprintf(me->starpath, sizeof(me->starpath)-1, "%.*s.%.*s.star", (int)(strlen(me->path) - strptrLen), me->path, (int)strptrLen, strptr);
me->starred = fileExists(me->starpath);
return true;

View File

@ -101,7 +101,10 @@ static void menuSort(void) {
menuEntry_s** list = (menuEntry_s**)calloc(nEntries, sizeof(menuEntry_s*));
if(list == NULL) return;
menuEntry_s** listStar = (menuEntry_s**)calloc(nEntries, sizeof(menuEntry_s*));
if(listStar == NULL) return;
if(listStar == NULL) {
free(list);
return;
}
menuEntry_s* p = m->firstEntry;
for(i = 0; i < nEntries; ++i) {

View File

@ -38,7 +38,7 @@ void toggleStarState(menuEntry_s* arg) {
} else {
if (!fileExists(me->starpath)) {
FILE* f = fopen(me->starpath, "w");
fclose(f);
if (f) fclose(f);
}
}
me->starred = fileExists(me->starpath);