diff --git a/util.c b/util.c index c5eae75..a0392ce 100644 --- a/util.c +++ b/util.c @@ -608,7 +608,12 @@ double haversine_dist(double th1, double ph1, double th2, double ph2) void chomp(char *s) { - char *p = s + strlen(s) - 1; + char *p; + + if (!s || *s == 0) + return; + + p = s + strlen(s) - 1; while (isspace(*p)) { *p-- = 0;