summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pikul.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pikul.c b/pikul.c
index 8e657b8..1ccf717 100644
--- a/pikul.c
+++ b/pikul.c
@@ -92,7 +92,7 @@ static int servicecmp(const void *service1, const void *service2)
double pikul_cost(const char *origin, const char *destination, double weight, const char *code)
{
struct pikul_services *services = pikul_services(origin, destination, weight);
- if (!services)
+ if (!services || !services->length)
return .0;
qsort(services->list, services->length, sizeof(struct pikul_service *), servicecmp);
struct pikul_service *key_service = malloc(sizeof(struct pikul_service));