]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix crash when output-preview-framework is missing
authorPatrick McCarty <pnorcks@gmail.com>
Thu, 28 May 2009 00:40:20 +0000 (17:40 -0700)
committerPatrick McCarty <pnorcks@gmail.com>
Fri, 17 Jul 2009 09:43:22 +0000 (02:43 -0700)
* If -dpreview is used when output-preview-framework
  does not exist for the given backend, LilyPond crashes.

  This patch implements checks for both output-framework
  and output-preview-framework, and issues warnings if
  they do not exist.

Signed-off-by: Patrick McCarty <pnorcks@gmail.com>
(cherry picked from commit 27f9029238357e9e3e7938f0667445d5e775e991)

lily/paper-book.cc

index 4307bb03eaa66880ac2fd9df18817978d43cc9ad..fd519d5d751fee66e7af54d84a8f14b989c40e04 100644 (file)
@@ -9,6 +9,7 @@
 #include "paper-book.hh"
 
 #include "grob.hh"
+#include "international.hh"
 #include "main.hh"
 #include "output-def.hh"
 #include "paper-column.hh"
@@ -174,25 +175,38 @@ Paper_book::output (SCM output_channel)
 
   if (get_program_option ("print-pages"))
     {
-      SCM func = scm_c_module_lookup (mod, "output-framework");
-
-      func = scm_variable_ref (func);
-      scm_apply_0 (func, scm_list_n (output_channel,
-                                    self_scm (),
-                                    scopes,
-                                    dump_fields (),
-                                    SCM_UNDEFINED));
+      SCM framework = ly_module_lookup (mod, ly_symbol2scm ("output-framework"));
+
+      if (framework != SCM_BOOL_F)
+       {
+         SCM func = scm_variable_ref (framework);
+         scm_apply_0 (func, scm_list_n (output_channel,
+                                        self_scm (),
+                                        scopes,
+                                        dump_fields (),
+                                        SCM_UNDEFINED));
+       }
+      else
+       warning (_f ("program option -dprint-pages not supported by backend `%s'",
+                    get_output_backend_name ()));
     }
 
   if (get_program_option ("preview"))
     {
-      SCM func = scm_c_module_lookup (mod, "output-preview-framework");
-      func = scm_variable_ref (func);
-      scm_apply_0 (func, scm_list_n (output_channel,
-                                    self_scm (),
-                                    scopes,
-                                    dump_fields (),
-                                    SCM_UNDEFINED));
+      SCM framework = ly_module_lookup (mod, ly_symbol2scm ("output-preview-framework"));
+
+      if (framework != SCM_BOOL_F)
+       {
+         SCM func = scm_variable_ref (framework);
+         scm_apply_0 (func, scm_list_n (output_channel,
+                                        self_scm (),
+                                        scopes,
+                                        dump_fields (),
+                                        SCM_UNDEFINED));
+       }
+      else
+       warning (_f ("program option -dpreview not supported by backend `%s'",
+                    get_output_backend_name ()));
     }
 }