1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

Deal with the possibility of no valid font being selected at all

during an entire run of unifontsel (because unifontsel_set_name was
either not called at all, or called with a name that didn't
correspond to any known font). In this situation we grey out the OK
button until a valid font is selected, and we have
unifontsel_get_name return NULL rather than failing an assertion if
it should be called in that state. The current client code in
gtkdlg.c should never encounter a NULL return, since it only calls
it after the OK button is clicked, but I've stuck an assertion in
there too on general principles.

[originally from svn r7953]
This commit is contained in:
Simon Tatham
2008-03-29 14:21:25 +00:00
parent f07f782547
commit ae802c16d8
2 changed files with 7 additions and 1 deletions

View File

@ -1226,6 +1226,7 @@ static void fontsel_ok(GtkButton *button, gpointer data)
(GTK_OBJECT(button), "user-data");
struct uctrl *uc = (struct uctrl *)fontsel->user_data;
char *name = unifontsel_get_name(fontsel);
assert(name); /* should always be ok after OK pressed */
gtk_entry_set_text(GTK_ENTRY(uc->entry), name);
sfree(name);
}