summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pjlib/include/pj/math.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/pjlib/include/pj/math.h b/pjlib/include/pj/math.h
index c8f7ce48..9d7653ec 100644
--- a/pjlib/include/pj/math.h
+++ b/pjlib/include/pj/math.h
@@ -167,6 +167,7 @@ PJ_INLINE(void) pj_math_stat_update(pj_math_stat *stat, int val)
*/
PJ_INLINE(unsigned) pj_math_stat_get_stddev(pj_math_stat *stat)
{
+ if (stat->n == 0) return 0;
return (pj_isqrt((unsigned)(stat->m2_/stat->n)));
}