fixed fclose bug (NiLuJe)

This commit is contained in:
David Anderson 2006-03-01 20:59:08 +00:00
parent a9cdb2b48e
commit 2d6c06b82f

View File

@ -633,19 +633,16 @@ static cell AMX_NATIVE_CALL amx_feof(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL amx_fclose(AMX *amx, cell *params) static cell AMX_NATIVE_CALL amx_fclose(AMX *amx, cell *params)
{ {
cell *addr = get_amxaddr(amx, params[1]); FILE *fp = (FILE *)params[1];
if (*addr)
{ if (!fp)
FILE *fp = (FILE *)*addr; return 1;
fclose(fp); fclose(fp);
*addr = 0;
return 1; return 1;
} }
return 0;
}
static cell AMX_NATIVE_CALL amx_filesize(AMX *amx, cell *params) static cell AMX_NATIVE_CALL amx_filesize(AMX *amx, cell *params)
{ {
int len; int len;