Commit 9f86245
committed
fix: avoid crash in symlink_package rule
When a target does not have any in the provider, the rule would crash with an index out of range error.
This change adds a check to ensure the list is not empty before trying to access its elements, preventing the crash.
```
ERROR: ../2fa837e4c5ce941f68b762e5f8e7dc4d/external/rules_angular~/BUILD.bazel:8:16: in symlink_package rule @@rules_angular~//:node_modules/typescript:
Traceback (most recent call last):
File "../2fa837e4c5ce941f68b762e5f8e7dc4d/external/rules_angular~/src/private/symlink_package.bzl", line 22, column 63, in _symlink_impl
store_info = src[JsInfo].npm_package_store_infos.to_list()[0]
Error: index out of range (index is 0, but sequence has 0 elements)
ERROR: ../2fa837e4c5ce941f68b762e5f8e7dc4d/external/rules_angular~/BUILD.bazel:8:16: Analysis of target '@@rules_angular~//:node_modules/typescript' failed
ERROR: Analysis of target '//packages/angular/ssr/schematics:ssr_schematics_test_lib_strict_deps_test' failed; build aborted: Analysis failed
INFO: Elapsed time: 10.270s, Critical Path: 0.02s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
```1 parent f568493 commit 9f86245
1 file changed
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
0 commit comments