Skip to content

Commit 7b82cd2

Browse files
authored
Merge pull request #46 from Disinterpreter/amx-test-filefix
fix the crash with opening the file
2 parents 7acf989 + 31cd056 commit 7b82cd2

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

amx-test/pawno/settings.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
FileAssoc=1
33
[Display]
44
WindowMax=1
5-
WindowX=437
6-
WindowY=253
5+
WindowX=557
6+
WindowY=268
77
WindowW=790
88
WindowH=485
99
Splitter=339

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)