aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2011-09-20 17:04:54 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2011-09-20 17:04:54 +0000
commit4ef4a3097fbdf5f0a13d3f5b3e60cdbb02fe1671 (patch)
tree95cd73f720dc79f1b6a2ddb88b85bebe5253384a /src
parent57f342753ea40b66544494048193fc92435877aa (diff)
fixed crash when add2 to an empty buffer
heopfully also fixed bug when append2 an empty buffer svn path=/trunk/externals/zexy/; revision=15318
Diffstat (limited to 'src')
-rw-r--r--src/msgfile.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/msgfile.c b/src/msgfile.c
index 1d6224c..dd772fe 100644
--- a/src/msgfile.c
+++ b/src/msgfile.c
@@ -410,9 +410,13 @@ static void msgfile_add(t_msgfile *x, t_symbol *s, int ac, t_atom *av)
static void msgfile_add2(t_msgfile *x, t_symbol *s, int ac, t_atom *av)
{
msgfile_end(x);
- if (x->current->previous) x->current = x->current->previous;
+ if (x->current) {
+ if(x->current->previous) x->current = x->current->previous;
+ } else {
+ add_currentnode(x);
+ }
write_currentnode(x, ac, av);
- if (x->current->next) {
+ if (x->current && x->current->next) {
x->previous= x->current;
x->current = x->current->next;
}
@@ -424,6 +428,9 @@ static void msgfile_append(t_msgfile *x, t_symbol *s, int ac, t_atom *av)
}
static void msgfile_append2(t_msgfile *x, t_symbol *s, int ac, t_atom *av)
{
+ if(!x->current)
+ add_currentnode(x);
+
if (x->current->thislist) write_currentnode(x, ac, av);
else msgfile_append(x, s, ac, av);
}