From 9b8585e25f8fd981adcc77cf452bbeb0b0939dbd Mon Sep 17 00:00:00 2001 From: malc Date: Tue, 15 Jun 2010 01:14:34 +0400 Subject: [PATCH] Alert the use if he tries to go to the outline mode but there's no outline --- main.ml | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/main.ml b/main.ml index 6dc4b40..6d037bc 100644 --- a/main.ml +++ b/main.ml @@ -652,19 +652,25 @@ let enteroutlinemode () = state.outlines <- Oarray a; a in - let active = - let rec loop n = - if n = Array.length outlines - then 0 - else - let (_, _, outlinepageno, _) = outlines.(n) in - if outlinepageno >= pageno then n else loop (n+1) + if Array.length outlines = 0 + then ( + showtext ' ' "Document has no outline"; + Glut.swapBuffers () + ) + else + let active = + let rec loop n = + if n = Array.length outlines + then 0 + else + let (_, _, outlinepageno, _) = outlines.(n) in + if outlinepageno >= pageno then n else loop (n+1) + in + loop 0 in - loop 0 - in - state.outline <- - Some (active, max 0 (active - maxoutlinerows ()), outlines, ""); - Glut.postRedisplay (); + state.outline <- + Some (active, max 0 (active - maxoutlinerows ()), outlines, ""); + Glut.postRedisplay (); ;; let viewkeyboard ~key ~x ~y = -- 2.11.4.GIT