Skip to content

Commit ed668b6

Browse files
author
梶塚太智
committed
Debug initial data
Debugged initial data index bug
1 parent 9477838 commit ed668b6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,15 @@ impl Executor {
10351035
for item in &mut class.to_owned()[1..class.len()].iter() {
10361036
let mut item = item.to_owned();
10371037
if item.get_list().len() == 1 {
1038-
let element = &data[index];
1038+
let element = match data.get(index) {
1039+
Some(value) => value,
1040+
None => {
1041+
self.log_print(format!("Error! initial data is shortage\n"));
1042+
self.stack
1043+
.push(Type::Error("instance-shortage".to_string()));
1044+
return;
1045+
}
1046+
};
10391047
object.insert(
10401048
item.get_list()[0].to_owned().get_string(),
10411049
element.to_owned(),

0 commit comments

Comments
 (0)