summaryrefslogtreecommitdiff
path: root/libmate-desktop/mate-bg.c
diff options
context:
space:
mode:
authorMonsta <[email protected]>2015-07-21 14:49:33 +0300
committerMonsta <[email protected]>2015-07-21 15:01:38 +0300
commitc7c92f8c7aaa72125b43aa25b3be3e5dea4b28bf (patch)
tree118f62bbcd897e057bd3863ec1b0fa08ab31d6e0 /libmate-desktop/mate-bg.c
parent9e84d7f44354eaeceae03df1933192b420f7c201 (diff)
downloadmate-desktop-c7c92f8c7aaa72125b43aa25b3be3e5dea4b28bf.tar.bz2
mate-desktop-c7c92f8c7aaa72125b43aa25b3be3e5dea4b28bf.tar.xz
bg slideshow: smarter check for NULL pointers
Diffstat (limited to 'libmate-desktop/mate-bg.c')
-rw-r--r--libmate-desktop/mate-bg.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c
index b0c3c90..b5e0993 100644
--- a/libmate-desktop/mate-bg.c
+++ b/libmate-desktop/mate-bg.c
@@ -2857,10 +2857,14 @@ handle_text (GMarkupParseContext *context,
GError **err)
{
SlideShow *parser = user_data;
- Slide *slide = parser->slides->tail? parser->slides->tail->data : NULL;
FileSize *fs;
gint i;
+ g_return_if_fail (parser != NULL);
+ g_return_if_fail (parser->slides != NULL);
+
+ Slide *slide = parser->slides->tail ? parser->slides->tail->data : NULL;
+
if (stack_is (parser, "year", "starttime", "background", NULL)) {
parser->start_tm.tm_year = parse_int (text) - 1900;
}
@@ -2881,11 +2885,15 @@ handle_text (GMarkupParseContext *context,
}
else if (stack_is (parser, "duration", "static", "background", NULL) ||
stack_is (parser, "duration", "transition", "background", NULL)) {
+ g_return_if_fail (slide != NULL);
+
slide->duration = g_strtod (text, NULL);
parser->total_duration += slide->duration;
}
else if (stack_is (parser, "file", "static", "background", NULL) ||
stack_is (parser, "from", "transition", "background", NULL)) {
+ g_return_if_fail (slide != NULL);
+
for (i = 0; text[i]; i++) {
if (!g_ascii_isspace (text[i]))
break;
@@ -2902,12 +2910,16 @@ handle_text (GMarkupParseContext *context,
}
else if (stack_is (parser, "size", "file", "static", "background", NULL) ||
stack_is (parser, "size", "from", "transition", "background", NULL)) {
+ g_return_if_fail (slide != NULL);
+
fs = slide->file1->data;
fs->file = g_strdup (text);
if (slide->file1->next != NULL)
parser->has_multiple_sizes = TRUE;
}
else if (stack_is (parser, "to", "transition", "background", NULL)) {
+ g_return_if_fail (slide != NULL);
+
for (i = 0; text[i]; i++) {
if (!g_ascii_isspace (text[i]))
break;
@@ -2923,6 +2935,8 @@ handle_text (GMarkupParseContext *context,
parser->has_multiple_sizes = TRUE;
}
else if (stack_is (parser, "size", "to", "transition", "background", NULL)) {
+ g_return_if_fail (slide != NULL);
+
fs = slide->file2->data;
fs->file = g_strdup (text);
if (slide->file2->next != NULL)