Skip to content

Commit d2d9478

Browse files
fix the crash with opening the file
1 parent 0a7cb52 commit d2d9478

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

amx-test/testgm.amx

113 Bytes
Binary file not shown.

amx-test/testgm.pwn

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,18 @@ public OnGameModeInit()
2020
print("");
2121
2222
new File:f = fopen("file.txt", io_read);
23-
new buffer[512];
24-
fread(f, buffer, sizeof(buffer));
25-
fclose(f);
26-
printf("%s", buffer);
23+
if (f == File:0)
24+
{
25+
printf("There is a problem with openning the file.");
26+
}
27+
else
28+
{
29+
new buffer[512];
30+
fread(f, buffer, sizeof(buffer));
31+
fclose(f);
32+
printf("%s", buffer);
33+
fclose(f);
34+
}
2735
2836
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
2937
SetRuleValue("nya", "test");

0 commit comments

Comments
 (0)