-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path006-malformed-package-script-value-panics.patch
More file actions
34 lines (32 loc) · 2.12 KB
/
006-malformed-package-script-value-panics.patch
File metadata and controls
34 lines (32 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
diff --git a/src/runtime/cli/create_command.rs b/src/runtime/cli/create_command.rs
index 79fefcd6ec..9bcbb3be93 100644
--- a/src/runtime/cli/create_command.rs
+++ b/src/runtime/cli/create_command.rs
@@ -1312,14 +1312,21 @@ impl CreateCommand {
let mut script_property_i: usize = 0;
while script_property_i < scripts_properties.len() {
- let script = scripts_properties[script_property_i]
- .value
- .unwrap()
- .data
- .e_string()
- .unwrap()
- .data
- .slice();
+ let Some(script_value) = scripts_properties[script_property_i].value else {
+ scripts_properties
+ .swap(script_property_out_i, script_property_i);
+ script_property_out_i += 1;
+ script_property_i += 1;
+ continue;
+ };
+ let Some(script_value) = script_value.data.e_string() else {
+ scripts_properties
+ .swap(script_property_out_i, script_property_i);
+ script_property_out_i += 1;
+ script_property_i += 1;
+ continue;
+ };
+ let script = script_value.data.slice();
if strings::contains(script, b"react-scripts start")
|| strings::contains(script, b"next dev")