Skip to content

Commit

Permalink
Return immediately when an exception occurs, no more wasted time
Browse files Browse the repository at this point in the history
  • Loading branch information
easy-3dp authored and MikhailK committed Apr 18, 2024
1 parent eca9c20 commit 83e5e49
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions runtime/src/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(crate) fn check_obj(_alg_id: &[u8;16], _obj: &Vec<u8>, _hashes: &Vec<H256>)

fn check_simply_connected(obj: &Vec<u8>) -> bool {
if let Ok(text) = from_utf8(&obj) {
let mut vs_list = btree_set::BTreeSet::new();//::with_capacity(6000);
let mut vs_list = btree_set::BTreeSet::new();
for line in text.lines() {
let words: Vec<&str> = line.split_whitespace().collect();
if words.len() > 0 {
Expand All @@ -32,8 +32,12 @@ fn check_simply_connected(obj: &Vec<u8>) -> bool {
if swords.len() == 3 {
if let Ok(i) = swords[0].parse() {
vs[idx-1] = i;
}
}
} else {
return false;
}
} else {
return false;
}
}
if vs_list.is_empty()
|| vs_list.contains(&vs[0])
Expand All @@ -45,7 +49,9 @@ fn check_simply_connected(obj: &Vec<u8>) -> bool {
} else {
return false;
}
}
} else {
return false;
}
},
_=>{},
}
Expand Down

0 comments on commit 83e5e49

Please sign in to comment.