X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=tabular.c;h=83c17898248b07dd3495be769bbcdc7b35eddd2c;hb=a3f2e6cf008678cfa2b1a868e38fefbe81009971;hp=0252a8e8ec1bf82aad5e3f6a723db40644fe35de;hpb=3559b26cba4b13ce35a27aed478b3a5e0433be31;p=calc.git diff --git a/tabular.c b/tabular.c index 0252a8e..83c1789 100644 --- a/tabular.c +++ b/tabular.c @@ -43,6 +43,9 @@ tab_t *resize_tab (tab_t *tab, int nb) tab_t *copy_tab (tab_t *tab) { + if (tab == NULL) { + return NULL; + } tab_t *new = alloc_tab (tab->size); memcpy (new->data, tab->data, tab->size * sizeof (double)); return new; @@ -154,8 +157,8 @@ double pop_tab (tab_t *tab, int id) void order_tab (tab_t *tab) { int i, j; - if ((!tab) || (tab->size < 3)) { - VERBOSE (WARNING, fprintf (stdout, "error not enough element in stack (%d)\n", tab->size)); + if ((!tab) || (tab->size < 2)) { + VERBOSE (WARNING, fprintf (stdout, "error not enough element in stack (%d)\n", (tab) ? tab->size : 0)); return; }