Skip to content

Commit 8dfdd67

Browse files
author
qun-wei.lin
committed
Fix ValueError in get_submission() when doing int()
If the result of get_submissions() contains some invalid submissions, such as compile error, it will cause get_submission() to get a non-integer value when fetching the runtime, which will cause a ValueError. Signed-off-by: qun-wei.lin <[email protected]>
1 parent 2ecaf6b commit 8dfdd67

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

autoload/leetcode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ def get_submission(sid):
541541
# the second key "runtime" is the runtime in milliseconds
542542
# we need to search from the position after the first "runtime" key
543543
prev_runtime = re.search("runtime: '([^']*)'", s)
544-
if not prev_runtime:
544+
if not prev_runtime or not _group1(prev_runtime, 'N/A').split()[0].isdigit():
545545
my_runtime = 0
546546
else:
547547
my_runtime = int(_group1(re.search("runtime: '([^']*)'", s[prev_runtime.end():]), 0))

0 commit comments

Comments
 (0)