Commit 2be59b9
improve: SettingsData.FromJson null safety + GatewayUrlHelper static array (#148)
Two small coding improvements:
1. SettingsData.FromJson(string? json) — null/empty guard
- Change parameter from non-nullable 'string' to 'string?'
- Return null immediately for null or empty input rather than
forwarding to JsonSerializer.Deserialize which would throw
ArgumentNullException (not caught by the existing JsonException
handler)
- Adds two regression tests: null and empty string both return null
2. GatewayUrlHelper.RemoveUserInfo — static readonly char array
- Replace the inline 'new[] { '/', '?', '#' }' array literal
in RemoveUserInfo with a 'private static readonly' field
- The method is called on every URL normalisation and display
sanitisation; the previous form allocated a new char array on
each call, which is now eliminated
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent b202642 commit 2be59b9
3 files changed
+14
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
141 | 143 | | |
142 | 144 | | |
143 | 145 | | |
144 | | - | |
| 146 | + | |
145 | 147 | | |
146 | 148 | | |
147 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
173 | 181 | | |
174 | 182 | | |
175 | 183 | | |
| |||
0 commit comments