summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErkin Bahceci <erkinbah@gmail.com>2009-08-24 23:13:46 -0500
committerErkin Bahceci <erkinbah@gmail.com>2009-08-24 23:13:46 -0500
commitadec11ca12f56afe5ccaf62fb82c20804af34774 (patch)
tree8149109ded57905767e2b6eb7a71f5e345d47a26
parent68b3ca0675cc8cbe2e6d375934ec7558f5c90454 (diff)
downloadcolorfilter-compiz-0.8.tar.gz
colorfilter-compiz-0.8.tar.bz2
Handle empty filter name.compiz-0.8
e.g: when it happens while adding a new one in ccsm.
-rw-r--r--colorfilter.c8
-rw-r--r--parser.c2
2 files changed, 7 insertions, 3 deletions
diff --git a/colorfilter.c b/colorfilter.c
index f7674d1..43f7c7d 100644
--- a/colorfilter.c
+++ b/colorfilter.c
@@ -323,11 +323,15 @@ loadFilters (CompScreen *s, CompTexture *texture)
for (i = 0; i < count; i++)
{
name = base_name (filters->value[i].s);
- if (!strlen (name))
+ if (!name || !strlen (name))
{
- free (name);
+ if (name)
+ free (name);
+
+ cfs->filtersFunctions[i] = 0;
continue;
}
+
compLogMessage ("colorfilter", CompLogLevelInfo,
"Loading filter %s (item %s).", name,
filters->value[i].s);
diff --git a/parser.c b/parser.c
index e34ccb1..d8d67bf 100644
--- a/parser.c
+++ b/parser.c
@@ -66,7 +66,7 @@ base_name (char *str)
if (!current)
return NULL;
/* Trim terminating '/' if needed */
- if (current[(length - 1)] == '/')
+ if (length > 0 && current[(length - 1)] == '/')
current[(length - 1)] = 0;
return current;
}