8000 fix: Do not crash due to unavailable tracks in queue by hrkfdn · Pull Request #1656 · hrkfdn/ncspot · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: Do not crash due to unavailable tracks in queue #1656

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

Merged
merged 2 commits into from
Jun 8, 2025

Conversation

hrkfdn
Copy link
Owner
@hrkfdn hrkfdn commented Jun 8, 2025

Fixes #1616

Describe your changes

Issue ticket number and link

Checklist before requesting a review

  • Documentation was updated (i.e. due to changes in keybindings, commands, etc.)
  • Changelog was updated with relevant user-facing changes (eg. not dependency updates,
    not performance improvements, etc.)

@hrkfdn hrkfdn requested a review from Copilot June 8, 2025 20:48
Copilot

This comment was marked as outdated.

@hrkfdn hrkfdn requested a review from Copilot June 8, 2025 20:54
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a crash that occurs when the queue has unavailable tracks by safely handling arithmetic operations in the status bar rendering logic.

  • Replace unchecked arithmetic with safe multiplication and division for computing the progress bar width.
  • Update the changelog to document the crash fix.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/ui/statusbar.rs Uses checked arithmetic to prevent integer overflows in progress bar calculation.
CHANGELOG.md Adds an entry to document the crash fix.
Comments suppressed due to low confidence (1)

src/ui/statusbar.rs:193

  • [nitpick] Consider adding a brief comment explaining the use of checked multiplication/division and the fallback behavior (using unwrap_or(0)) to aid future maintainers in understanding why silent failure is acceptable in this context.
let duration_width = elapsed_ms

@hrkfdn hrkfdn merged commit 6ffaf3b into main Jun 8, 2025
6 checks passed
@hrkfdn hrkfdn deleted the hf/unavailable_tracks_crash branch June 8, 2025 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash on some unavailable tracks
1 participant
0