Add an extra safety measure in case we don't find the toolbar settings.

see r37075--r37079.

(I think this commit doesn't need a separate status log message as it fits well in the one committed in r37079.)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@37080 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2011-01-03 17:18:05 +00:00
parent 59d5732815
commit 61e7c1472e

View File

@ -945,7 +945,17 @@ void GuiToolbar::saveSession() const
void GuiToolbar::restoreSession()
{
QSettings settings;
setVisibility(settings.value(sessionKey() + "/visibility").toInt());
int const error_val = -1;
int visibility =
settings.value(sessionKey() + "/visibility", error_val).toInt();
if (visibility == error_val || visibility == 0) {
// This should not happen, but in case it does, we use the defaults
LYXERR0("Session settings could not be found!. "
"Defaults are used instead");
visibility =
guiApp->toolbars().defaultVisibility(fromqstr(objectName()));
}
setVisibility(visibility);
}