OpenCut-app / OpenCut-app/OpenCut

[BUG] Division by zero panic in ResizablePanelGroup

Open Beginner friendly
#894 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
89.8k
Forks
8.9k
PR merge metrics
No merged PRs in 30d

Description

Bug Report

Platform

All platforms (Linux, macOS, Windows, WSL2)

Current Behavior

In pps/desktop/src/components/resizable.rs:71-79, the drag fraction calculation divides by bounds width/height without checking for zero:

ust let fraction = match self.orientation { Orientation::Horizontal => { (event.event.position.x - bounds.left()) / (bounds.right() - bounds.left()) // Can be 0 } Orientation::Vertical => { (event.event.position.y - bounds.top()) / (bounds.bottom() - bounds.top()) // Can be 0 } };

If the panel group has zero width or height (e.g., during window initialization, minimized state, or layout edge cases), this causes a division by zero panic.

Expected Behavior

The calculation should guard against zero-size bounds and return a safe default fraction.

Steps To Reproduce
  1. Run the desktop app
  2. Resize window to minimum size or trigger a layout where panel bounds collapse to zero
  3. Attempt to drag the resizable handle
Recurrence Probability

Sometimes - depends on window state and layout timing

Additional Context

Critical bug - causes immediate panic/crash. Should be fixed before any PRs are accepted.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in desktop/src/components/resizable.rs:71-79 and inspect the horizontal and vertical drag fraction calculations. Reproduce the issue by collapsing or minimizing the window, then verify that zero-size bounds produce a safe default fraction without a panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.