File->stat gives error: "No Error"

I have this code:

const char* path = "assets/texture.png";
FileStat fstat;
if (pd->file->stat(path, &fstat) != 0)
{
     pd->system->logToConsole("!!");
     *outerr = pd->file->geterr();
      return NULL;
}

Paradoxically, stat is apparently returning a non-zero value, but the error I'm getting is "No error".

EDIT: ok, it appears that logToConsole is overwriting the error to become "No Error." The actual error is "No such file," but it is overshadowed by the success of logToConsole. It is confusing that system->logToConsole sets the file error flag, though!