Cancel Catch

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

A code review of a MATLAB snippet where a developer incorrectly uses a try/catch block to handle the cancel action from a file dialog (uigetfile). The function actually returns 0 on cancel rather than throwing an exception, so the catch block never fires, and the zero values propagate silently until something tries to open a file and crashes unexpectedly.

2m read timeFrom thedailywtf.com
Post cover image

Sort: