summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tsort.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tsort.c b/src/tsort.c
index 0b36a3368..f26cfa395 100644
--- a/src/tsort.c
+++ b/src/tsort.c
@@ -315,7 +315,7 @@ scan_zeros (struct item *k)
static void
detect_loop (struct item *k)
{
- if (k->count > 0)
+ if (k->count > 0 && k->top)
{
while (k && k->count > 0)
{