Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expr: fix tikv crash when conv empty string #12672

Merged
merged 5 commits into from May 30, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion components/tidb_query_expr/src/impl_math.rs
Expand Up @@ -616,7 +616,7 @@ fn is_valid_base(base: IntWithSign) -> bool {

fn extract_num_str(s: &str, from_base: IntWithSign) -> Option<(String, bool)> {
let mut iter = s.chars().peekable();
let head = *iter.peek().unwrap();
let head = *iter.peek()?;
let mut is_neg = false;
if head == '+' || head == '-' {
is_neg = head == '-';
Expand Down Expand Up @@ -1568,6 +1568,7 @@ mod tests {
("16九a", 10, 8, "20"),
("+", 10, 8, "0"),
("-", 10, 8, "0"),
("", 2, 16, "0"),
];
for (n, f, t, e) in tests {
let n = Some(n.as_bytes().to_vec());
Expand Down