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

View File

@ -97,6 +97,9 @@ EstrInt2Enc(const char *str, int want_utf8)
if (Mode.text.utf8_int == want_utf8)
return (char *)str;
if (str == NULL)
return NULL;
if (want_utf8)
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)
return;
Efree((char *)str);
if (str)
Efree((char *)str);
#endif
}

View File

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

View File

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