openrails icon indicating copy to clipboard operation
openrails copied to clipboard

Fix TrackViewer crash on big zoom value

Open Fred-si opened this issue 1 year ago • 2 comments

Hi,

My son found a little bug in the TrackViewer program. With a really big value of zoom, the program crashes due to an unhandled ArgumentException

After investigating, I have found that with a really big zoom value, the width becomes 0.0, and the result of pass zero for the value of nearPlaneDistance parameter of the Matrix.CreatePerspectiveFieldOfView method.

This PR proposed to solve this issue by returning without updating the camera when the nearPlaneDistance computed value is less or equals to zero.

Fred-si avatar Jun 23 '24 15:06 Fred-si

Hi Fred,

Thanks for investigating this and submitting your fix.

I've added the label "for-unstable", which means that it will now be included in the automatic builds of the Unstable Version.

Your code change looks very clean, but let's leave it in Unstable for 2 weeks or so to check that there are no unwanted consequences. After that, I will approve and merge into the Testing Version ("master" branch).

Best wishes,

Chris

cjakeman avatar Jun 29 '24 11:06 cjakeman

Hi Chris,

Thanks for the review. I've taken note of the validation process.

Best wishes.

Fred-si avatar Jun 30 '24 08:06 Fred-si