bug fix, avoid segfault when indexing a vector with a nonexistant variable
This commit is contained in:
parent
8e7adac18e
commit
3ece54fb94
|
|
@ -1,3 +1,8 @@
|
||||||
|
2011-06-02 Robert Larice
|
||||||
|
* src/frontend/com_let.c :
|
||||||
|
bug fix, avoid segfault when indexing a vector with a nonexistant variable
|
||||||
|
let foo = thing[nonsuchthing]
|
||||||
|
|
||||||
2011-06-02 Robert Larice
|
2011-06-02 Robert Larice
|
||||||
* src/frontend/postcoms.c :
|
* src/frontend/postcoms.c :
|
||||||
bug fix, avoid $curplot (plot_names) being assembled from negative numbers
|
bug fix, avoid $curplot (plot_names) being assembled from negative numbers
|
||||||
|
|
|
||||||
|
|
@ -79,8 +79,18 @@ com_let(wordlist *wl)
|
||||||
/* va, indexing */
|
/* va, indexing */
|
||||||
fake_wl.wl_word = s;
|
fake_wl.wl_word = s;
|
||||||
nn = ft_getpnames(&fake_wl, TRUE);
|
nn = ft_getpnames(&fake_wl, TRUE);
|
||||||
|
if (!nn) {
|
||||||
|
/* XXX error message */
|
||||||
|
tfree(p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
t = ft_evaluate(nn);
|
t = ft_evaluate(nn);
|
||||||
|
if (!t) {
|
||||||
|
fprintf(cp_err, "Error: Can't evaluate %s\n", s);
|
||||||
|
free_pnode(nn);
|
||||||
|
tfree(p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!isreal(t) || t->v_link2 || t->v_length != 1 || !t->v_realdata)
|
if (!isreal(t) || t->v_link2 || t->v_length != 1 || !t->v_realdata)
|
||||||
{
|
{
|
||||||
fprintf(cp_err, "Error: index is not a scalar.\n");
|
fprintf(cp_err, "Error: index is not a scalar.\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue