Commit b541d39
committed
Fix update check failing at random
Although this code contains many optimizations, the "actual" fix is on line 26 of `check_updates.gml`: upon doing an HTTP request, GameMaker sends multiple callbacks to inform async events about the "progress" of the request, during which the `status` field on `async_load` will be 1. The `result` will only be available when `status == 0` (success), so we must ONLY stop processing the callbacks (setting `update_http` to -1) when this occurs.
Previously, the script was setting `update_http` to -1 as soon as the first callback was received, which means `result` might not have been available yet. The `http_status` would also be `undefined` when this occurred, which meant that checking for the update would randomly fail.
Read more about it here: https://manual.yoyogames.com/GameMaker_Language/GML_Reference/Asynchronous_Functions/HTTP/http_get.htm
https://docs2.yoyogames.com/source/_build/2_interface/1_editors/events/async_events.html1 parent c8e9117 commit b541d39
1 file changed
+45
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
19 | 38 | | |
| 39 | + | |
20 | 40 | | |
21 | 41 | | |
22 | 42 | | |
23 | | - | |
| 43 | + | |
24 | 44 | | |
25 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
26 | 62 | | |
27 | 63 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | 64 | | |
46 | 65 | | |
0 commit comments