diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2017-11-03 00:03:08 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2017-11-03 00:03:08 -0400 |
commit | 0fb5be754c71bf854533988459d267498a837f1c (patch) | |
tree | 9671441c73804f2bd68fc3b15f0cedf2ab11c980 | |
parent | 1c9820d4da595ac891a7bd8382d2bad7d6b2ff76 (diff) | |
download | c++-0fb5be754c71bf854533988459d267498a837f1c.tar.gz c++-0fb5be754c71bf854533988459d267498a837f1c.tar.bz2 c++-0fb5be754c71bf854533988459d267498a837f1c.zip |
fixed bug that crashed convex calculator when the number of nonnegative values was too small
-rw-r--r-- | lib/convex.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/convex.c b/lib/convex.c index 33af1b4..4816aeb 100644 --- a/lib/convex.c +++ b/lib/convex.c @@ -6,6 +6,10 @@ double slope(point_t *P, point_t *Q) { } double *get_convex_minorant(uint64_t n, double *Gammas) { + if (n < 2) { + return Gammas; + } + list_t *L = (list_t *)calloc(1, sizeof(list_t)); L->p = (point_t *)calloc(1, sizeof(point_t)); L->p->x = 0; |