Additional NULL pointer checks (fixes some segv's).

SVN revision: 10351
This commit is contained in:
Kim Woelders 2004-05-24 17:39:51 +00:00
parent f5859b6b3e
commit f9087c660a
4 changed files with 29 additions and 11 deletions

View File

@ -735,16 +735,21 @@ RealiseEwinWinpart(EWin * ewin, int i)
static void static void
EwinWinpartITclassApply(EWin * ewin, int i) EwinWinpartITclassApply(EWin * ewin, int i)
{ {
const char *title;
IclassApply(ewin->border->part[i].iclass, ewin->bits[i].win, IclassApply(ewin->border->part[i].iclass, ewin->bits[i].win,
ewin->bits[i].w, ewin->bits[i].h, ewin->active, ewin->bits[i].w, ewin->bits[i].h, ewin->active,
ewin->sticky, ewin->bits[i].state, ewin->bits[i].expose); ewin->sticky, ewin->bits[i].state, ewin->bits[i].expose);
if (ewin->border->part[i].flags == FLAG_TITLE) if (ewin->border->part[i].flags == FLAG_TITLE)
TclassApply(ewin->border->part[i].iclass, ewin->bits[i].win, {
ewin->bits[i].w, ewin->bits[i].h, ewin->active, title = EwinGetTitle(ewin);
ewin->sticky, ewin->bits[i].state, ewin->bits[i].expose, if (title)
ewin->border->part[i].tclass, EwinGetTitle(ewin)); TclassApply(ewin->border->part[i].iclass, ewin->bits[i].win,
ewin->bits[i].w, ewin->bits[i].h, ewin->active,
ewin->sticky, ewin->bits[i].state, ewin->bits[i].expose,
ewin->border->part[i].tclass, title);
}
} }
static int static int
@ -823,16 +828,19 @@ int
ChangeEwinWinpartContents(EWin * ewin, int i) ChangeEwinWinpartContents(EWin * ewin, int i)
{ {
int state = 0, ret = 0; int state = 0, ret = 0;
const char *title;
EDBUG(3, "ChangeEwinWinpartContents"); EDBUG(3, "ChangeEwinWinpartContents");
ret = 1; ret = 1;
switch (ewin->border->part[i].flags) switch (ewin->border->part[i].flags)
{ {
case FLAG_TITLE: case FLAG_TITLE:
TclassApply(ewin->border->part[i].iclass, ewin->bits[i].win, title = EwinGetTitle(ewin);
ewin->bits[i].w, ewin->bits[i].h, ewin->active, if (title)
ewin->sticky, state, ewin->bits[i].expose, TclassApply(ewin->border->part[i].iclass, ewin->bits[i].win,
ewin->border->part[i].tclass, EwinGetTitle(ewin)); ewin->bits[i].w, ewin->bits[i].h, ewin->active,
ewin->sticky, state, ewin->bits[i].expose,
ewin->border->part[i].tclass, title);
break; break;
case FLAG_MINIICON: case FLAG_MINIICON:
break; break;

View File

@ -97,6 +97,9 @@ EstrInt2Enc(const char *str, int want_utf8)
if (Mode.text.utf8_int == want_utf8) if (Mode.text.utf8_int == want_utf8)
return (char *)str; return (char *)str;
if (str == NULL)
return NULL;
if (want_utf8) if (want_utf8)
return Eiconv(iconv_cd_int2utf8, str, strlen(str)); return Eiconv(iconv_cd_int2utf8, str, strlen(str));
@ -114,7 +117,8 @@ EstrInt2EncFree(const char *str, int want_utf8)
if (Mode.text.utf8_int == want_utf8) if (Mode.text.utf8_int == want_utf8)
return; return;
Efree((char *)str); if (str)
Efree((char *)str);
#endif #endif
} }

View File

@ -189,7 +189,7 @@ TclassApply(ImageClass * iclass, Window win, int w, int h, int active,
EDBUG(4, "TclassApply"); EDBUG(4, "TclassApply");
if ((!iclass) || (!tclass) || (!win) || (w < 1) || (h < 1)) if ((!iclass) || (!tclass) || (!text) || (!win) || (w < 1) || (h < 1))
EDBUG_RETURN_; EDBUG_RETURN_;
if (Mode.queue_up) if (Mode.queue_up)

View File

@ -245,6 +245,9 @@ TextSize(TextClass * tclass, int active, int sticky, int state,
*width = 0; *width = 0;
*height = 0; *height = 0;
if (!text)
EDBUG_RETURN_;
ts = TextGetState(tclass, active, sticky, state); ts = TextGetState(tclass, active, sticky, state);
if (!ts) if (!ts)
EDBUG_RETURN_; EDBUG_RETURN_;
@ -350,6 +353,9 @@ TextDraw(TextClass * tclass, Window win, int active, int sticky, int state,
EDBUG(4, "TextDraw"); EDBUG(4, "TextDraw");
if (!text)
EDBUG_RETURN_;
ts = TextGetState(tclass, active, sticky, state); ts = TextGetState(tclass, active, sticky, state);
if (!ts) if (!ts)
EDBUG_RETURN_; EDBUG_RETURN_;