Repository navigation
Commit 0c0d059
authored
[flutter_tools] Handle null version gracefully in CachedArtifact and MaterialFonts (#191494)
When artifact version files (such as
`bin/internal/material_fonts.version`) are missing or cannot be
resolved, `CachedArtifact.version` evaluates to `null`. Previously,
`CachedArtifact.update` invoked `updateInner` before checking if
`version` was `null`, causing `MaterialFonts.updateInner` (and other
artifact subclasses) to evaluate `version!` and throw an unhandled
`TypeError` / `_CastError` with `Null check operator used on a null
value`.
This change:
1. Returns early with a warning in `CachedArtifact.update` before
attempting `updateInner` or writing stamps when `version == null`.
2. Guards against `version == null` in `MaterialFonts`, `GradleWrapper`,
and `FlutterRunnerDebugSymbols`.
3. Adds an automated regression test in `cache_test.dart`.
Fixes #900921 parent 2483da2 commit 0c0d059
2 files changed
Lines changed: 39 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
957 | 957 | | |
958 | 958 | | |
959 | 959 | | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
960 | 969 | | |
961 | 970 | | |
962 | | - | |
963 | | - | |
964 | | - | |
965 | | - | |
966 | | - | |
967 | | - | |
968 | | - | |
969 | | - | |
970 | | - | |
| 971 | + | |
971 | 972 | | |
972 | 973 | | |
973 | 974 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
164 | 193 | | |
165 | 194 | | |
166 | 195 | | |
| |||
0 commit comments