Created attachment 5477 Patch fixing the issue described. In function thunar_chooser_dialog_response, if gtk_expander_get_expanded (GTK_EXPANDER (dialog->custom_expander) and gtk_tree_selection_get_selected (selection, &model, &iter) are false, app_info will not be initialized, which means it could later randomly pass a check for it being NULL while not holding a valid value. I found it with cppcheck, and attach a simple fix.
While reviewing some thunar patches on #xfce-dev, this one came up. This was a suggested change to your patch: <foutrelis> GAppInfo *app_info = NULL; would work better I think <foutrelis> no need to do it in a random else statement when it can be initialized when declared Thanks for taking the time to write the patch! If you do update it, you can always post it as a git patch so it's easier for maintainers to commit upstream and give you proper credit for your work.
Seems to have been fixed a while ago.