Skip to content

Commit

Permalink
Merge pull request #278 from hofheinz/master
Browse files Browse the repository at this point in the history
Fix segfault upon toggling builtin string variable
  • Loading branch information
keis committed May 16, 2016
2 parents f05ef86 + 44acf13 commit 1b54510
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/variables.c
Expand Up @@ -233,10 +233,9 @@ uzbl_variables_toggle (const gchar *name, GArray *values)
case TYPE_STR:
{
const gchar *next;
gchar *current = get_variable_string (var);

if (values && values->len) {
gchar *current = get_variable_string (var);

guint i = 0;
const gchar *first = argv_idx (values, 0);
const gchar *this = first;
Expand All @@ -251,17 +250,17 @@ uzbl_variables_toggle (const gchar *name, GArray *values)
next = first;
}

g_free (current);
} else {
next = "";

if (!strcmp (*var->value.s, "0")) {
if (!strcmp (current, "0")) {
next = "1";
} else if (!strcmp (*var->value.s, "1")) {
} else if (!strcmp (current, "1")) {
next = "0";
}
}

g_free (current);
sendev = set_variable_string (var, next);
break;
}
Expand Down

0 comments on commit 1b54510

Please sign in to comment.