Add a check for a NULL str before passing it to strcmp().

Otherwise, Linux and possibly other platforms with strict strcmp()
implementations will crash when the plugin list is NULL.  Thanks to
pollmann@netscape.com.
This commit is contained in:
ramiro 1998-05-15 11:21:09 +00:00
Родитель 4f6c1e3cc1
Коммит c9ae415b14
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -1102,9 +1102,15 @@ void XFE_PrefsApplEditDialog::buildPluginList(char *mimeType)
while (plugins[i]) {
xms = XmStringCreateLtoR(plugins[i], XmFONTLIST_DEFAULT_TAG);
DtComboBoxAddItem(fep->plugin_combo, xms, 0, True);
if ((i == 0) ||
(!strcmp(current_plugin, plugins[i])))
/*
* Linux crashes in strcmp() if current_plugin is NULL, so
* make sure it aint
*/
if ((i == 0) || (current_plugin && (!strcmp(current_plugin, plugins[i]))))
{
DtComboBoxSelectItem(fep->plugin_combo, xms);
}
XmStringFree(xms);
i++;
}