aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/markov.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/markov.h b/src/markov.h
index 2fdaf16..2cb22ce 100644
--- a/src/markov.h
+++ b/src/markov.h
@@ -69,6 +69,8 @@ void generate_chain(char *file_path)
for(int j = 0; j < ITEMS; j++)
all += items_seen[i][j];
+ if(all == 0) continue;
+
for(int j = 0; j < ITEMS; j++)
chain[i][j] = (double)items_seen[i][j]/all;
}