aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2016-01-08 08:59:13 +0100
committerThomas White <taw@bitwiz.org.uk>2016-01-08 08:59:13 +0100
commite003d06d57c6b8fb2e221592bb85a95a03941292 (patch)
tree440697a052832db168b820e519d8cd9083532a98
parent7d83e3cdfd2604364a1a240248db2a6de275a99d (diff)
Fix prev_slide()
-rw-r--r--src/presentation.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/presentation.c b/src/presentation.c
index 5b67ba5..2e439f8 100644
--- a/src/presentation.c
+++ b/src/presentation.c
@@ -316,20 +316,21 @@ SCBlock *next_slide(struct presentation *p, SCBlock *sl)
SCBlock *prev_slide(struct presentation *p, SCBlock *sl)
{
SCBlock *pp = parent_block(p, sl);
- SCBlock *bl = pp;
+ SCBlock *bl = p->scblocks;
SCBlock *l = NULL;
while ( bl != NULL ) {
+ if ( bl == pp ) {
+ if ( l == NULL ) return sl; /* Already on first slide */
+ return sc_block_child(l);
+ }
if ( safe_strcmp(sc_block_name(bl), "slide") == 0 ) {
l = bl;
}
- if ( bl == pp ) return l;
bl = sc_block_next(bl);
}
- if ( l == NULL ) {
- fprintf(stderr, "Couldn't find previous slide!\n");
- }
+ fprintf(stderr, "Couldn't find prev slide!\n");
return NULL;
}