-
-
Notifications
You must be signed in to change notification settings - Fork 37
Fix NaN/infinite value handling in SvgPoint constructor to prevent crashes #365
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
base: main
Are you sure you want to change the base?
Conversation
…ception Co-authored-by: warting <[email protected]>
…ctor Co-authored-by: warting <[email protected]>
warting
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't work around the issue, find the route cause and/or add some validation so that it is never NaN or Infinite
…ent NaN/infinite values Co-authored-by: warting <[email protected]>
You're absolutely right. I've addressed the root cause by adding coordinate validation at the input source in Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
warting
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont fallback
signature-view/src/main/java/se/warting/signatureview/views/SignaturePad.kt
Outdated
Show resolved
Hide resolved
…oordinates Remove silent fallback to 0f values and instead throw informative exceptions that help identify the source of NaN/infinite coordinates. This addresses maintainer feedback to identify root cause rather than masking symptoms. Co-authored-by: warting <[email protected]>
Removed the fallback approach. Instead of converting NaN/infinite values to 0f, the code now throws informative exceptions that help identify where and when invalid coordinates occur. This makes it easier to find the root cause rather than masking the problem. (fc63abd) |
warting
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix detekt and lint issues
…length Co-authored-by: warting <[email protected]>
Fixed all detekt and lint issues. Replaced |
Problem
The SvgPoint constructor was throwing
IllegalArgumentException: Cannot round NaN valuewhen TimedPoint objects contained NaN coordinates. This caused random crashes during signature drawing when touch events produced invalid coordinate values.Solution
Added validation in the SvgPoint constructor to handle both NaN and infinite values before calling
roundToInt(). When invalid values are detected, the coordinates default to 0, preventing crashes while maintaining functionality.This follows the same defensive pattern already used in
TimedPoint.velocityFrom()which checks for bothisInfinite()andisNaN().Testing
The fix is minimal (2 lines changed) and surgical, addressing only the specific crash condition without affecting existing functionality.
Fixes #336.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
http://168.63.129.16:80/machine//usr/bin/python3 -u bin/WALinuxAgent-2.13.1.1-py3.9.egg -collect-logs(http block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.