From: "Rodolfo García Peñas (kix)" <[email protected]>
This patch checks if the menu entries exist in the function
wWorkspaceRestoreState. scr->workspace_menu could be "not NULL"
and therefore it crash if the entries don't exits. So we
need check it first. I used the variable "menu" to make the lines
shorter and clear than "scr->workspace_menu":
---
src/workspace.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/workspace.c b/src/workspace.c
index a9a978b..dcbe6e8 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -848,6 +848,7 @@ void wWorkspaceSaveState(WScreen * scr, WMPropList *
old_state)
void wWorkspaceRestoreState(WScreen *scr)
{
WMPropList *parr, *pstr, *wks_state, *clip_state;
+ WMenu *menu = NULL;
int i, j;
make_keys();
@@ -871,9 +872,13 @@ void wWorkspaceRestoreState(WScreen *scr)
wWorkspaceNew(scr);
if (scr->workspace_menu) {
- wfree(scr->workspace_menu->entries[i +
MC_WORKSPACE1]->text);
- scr->workspace_menu->entries[i + MC_WORKSPACE1]->text =
wstrdup(WMGetFromPLString(pstr));
- scr->workspace_menu->flags.realized = 0;
+ menu = scr->workspace_menu;
+ if (menu->entries[i + MC_WORKSPACE1] &&
+ menu->entries[i + MC_WORKSPACE1]->text) {
+ wfree(menu->entries[i + MC_WORKSPACE1]->text);
+ menu->entries[i + MC_WORKSPACE1]->text =
wstrdup(WMGetFromPLString(pstr));
+ menu->flags.realized = 0;
+ }
}
wfree(scr->workspaces[i]->name);
--
1.7.10.4
--
To unsubscribe, send mail to [email protected].