Skip to content

Commit

Permalink
If a file was unable to be accessed, pressing ENTER on it would cause…
Browse files Browse the repository at this point in the history
… a NULL-pointer dereference (Problem introduced in v0.2.102, adding support for libancient)
  • Loading branch information
mywave82 committed Sep 14, 2024
1 parent ccd8169 commit 54b201a
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions filesel/pfilesel.c
Original file line number Diff line number Diff line change
Expand Up @@ -827,12 +827,15 @@ int fsGetPrevFile (struct moduleinfostruct *info, struct ocpfilehandle_t **fileh
{
if (m->file)
{
struct ocpfilehandle_t *ancient;
*filehandle = m->file->open (m->file);
if ((ancient = ancient_filehandle (0, 0, *filehandle)))
if (*filehandle)
{
(*filehandle)->unref (*filehandle);
*filehandle = ancient;
struct ocpfilehandle_t *ancient;
if ((ancient = ancient_filehandle (0, 0, *filehandle)))
{
(*filehandle)->unref (*filehandle);
*filehandle = ancient;
}
}
}

Expand Down Expand Up @@ -905,12 +908,15 @@ int fsGetNextFile (struct moduleinfostruct *info, struct ocpfilehandle_t **fileh

if (m->file)
{
struct ocpfilehandle_t *ancient;
*filehandle = m->file->open (m->file);
if ((ancient = ancient_filehandle (0, 0, *filehandle)))
if (*filehandle)
{
(*filehandle)->unref (*filehandle);
*filehandle = ancient;
struct ocpfilehandle_t *ancient;
if ((ancient = ancient_filehandle (0, 0, *filehandle)))
{
(*filehandle)->unref (*filehandle);
*filehandle = ancient;
}
}
}

Expand Down

0 comments on commit 54b201a

Please sign in to comment.