Skip to content

Prevent ArithmeticException in Session.getReplacerEnvironment#495

Open
tsautier wants to merge 1 commit intodrftpd-ng:masterfrom
tsautier:fix/issue-345
Open

Prevent ArithmeticException in Session.getReplacerEnvironment#495
tsautier wants to merge 1 commit intodrftpd-ng:masterfrom
tsautier:fix/issue-345

Conversation

@tsautier
Copy link
Copy Markdown

@tsautier tsautier commented Jan 14, 2026

Problem

Login fails with java.lang.ArithmeticException: / by zero when calculating average speed for a user. This occurs in Session.java when the user has zero time tracked.

Solution

Add a check for zero divisor before calculating average speed.

Changes Made

  • Modified Session.java to check for zero time before division
  • Average speed calculation now handles edge cases gracefully
  • Login no longer crashes for users with no transfer history

Fixes: #345

@tsautier
Copy link
Copy Markdown
Author

@mvangoor @hrxcodes for review

@tsautier tsautier changed the title Fix/issue 345 Prevent ArithmeticException in Session.getReplacerEnvironment Jan 14, 2026
@tsautier tsautier force-pushed the fix/issue-345 branch 3 times, most recently from 4b25ea0 to 9eb2ada Compare January 15, 2026 00:08
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.

Error on Login: java.lang.ArithmeticException / by zero

1 participant