Commit b1aa14c
authored
fix(pace-caret): prevent null dereference in update() (@byseif21) (monkeytypegame#7226)
### Description
* `update()` could hit a race where settings became `null` between
checks, causing a`TypeError` at runtime.
* Async callbacks (setTimeout) accessed the global settings after it was
cleared, leading to runaway errors.
<img width="1887" height="755" alt="Screenshot 2025-12-12 135316"
src="https://github.com/user-attachments/assets/ba6bd13c-c052-4870-ba7c-cfeae916b6dc"
/>
**fix**
settings once (currentSettings) at the start of update() and use that
for all property access and scheduling, so the loop never touches a
null/stale reference.1 parent e515506 commit b1aa14c
1 file changed
+15
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
134 | 139 | | |
135 | 140 | | |
136 | 141 | | |
| |||
146 | 151 | | |
147 | 152 | | |
148 | 153 | | |
149 | | - | |
150 | | - | |
| 154 | + | |
| 155 | + | |
151 | 156 | | |
152 | 157 | | |
153 | 158 | | |
| |||
157 | 162 | | |
158 | 163 | | |
159 | 164 | | |
160 | | - | |
161 | | - | |
| 165 | + | |
162 | 166 | | |
163 | | - | |
164 | | - | |
165 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
166 | 173 | | |
167 | 174 | | |
168 | 175 | | |
| |||
0 commit comments