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

Fix installer crashes when sideloading progress goes over 100% #400

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions openandroidinstaller/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def display_progress_bar(self, line: str):
percentage_done = int(result.group(1))
if percentage_done == 0:
percentage_done = 1
elif percentage_done == 100:
elif percentage_done >= 100:
percentage_done = 99

# update the progress bar
Expand All @@ -153,9 +153,10 @@ def set_progress_bar(self, percentage_done: int):
Args:
percentage_done (int): Percentage of the progress bar to be filled.
"""
assert (
percentage_done >= 0 and percentage_done <= 100
), "Percentage must be between 0 and 100"
assert percentage_done >= 0, "Percentage must be non-negative."
# clip the percentage to 100
if percentage_done > 100:
percentage_done = 100
if self.progress_bar:
self.progress_bar.value = percentage_done / 100
self.percentage_text.value = f"{percentage_done}%"
Expand Down