file dialog: Return an error if no file is selected

This was brought as a problem for bindings in #6139.

Fixes: #6139
This commit is contained in:
Matthias Clasen 2023-11-19 12:43:52 -05:00
parent 833d307695
commit 22ceb018fb

View File

@ -891,6 +891,10 @@ finish_file_op (GtkFileDialog *self,
if (g_list_model_get_n_items (files) > 0)
file = g_list_model_get_item (files, 0);
else
g_set_error_literal (error,
GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_FAILED,
"No file selected");
g_object_unref (files);