aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2018-03-20 18:54:18 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2018-03-20 19:01:19 +0100
commit3785fc5ea7f47849ae11764b5cca5c220bc3866d (patch)
tree759574d38f69b035a3e002d94159e677d2516022 /src
parent595462580d0eb1561f2497762fb55407c5ddf404 (diff)
downloadblogc-3785fc5ea7f47849ae11764b5cca5c220bc3866d.tar.gz
blogc-3785fc5ea7f47849ae11764b5cca5c220bc3866d.tar.bz2
blogc-3785fc5ea7f47849ae11764b5cca5c220bc3866d.zip
make: avoid infinite-loop if posts_per_page <= 0
Diffstat (limited to 'src')
-rw-r--r--src/blogc-make/rules.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/blogc-make/rules.c b/src/blogc-make/rules.c
index d8614b6..79d722a 100644
--- a/src/blogc-make/rules.c
+++ b/src/blogc-make/rules.c
@@ -228,6 +228,9 @@ pagination_outputlist(bm_ctx_t *ctx)
long posts_per_page = strtol(
bc_trie_lookup(ctx->settings->settings, "posts_per_page"),
NULL, 10); // FIXME: improve
+ if (posts_per_page <= 0)
+ return NULL;
+
size_t pages = ceilf(((float) num_posts) / posts_per_page);
const char *pagination_prefix = bc_trie_lookup(ctx->settings->settings,