From: Patrick McCarty Date: Thu, 28 May 2009 00:40:20 +0000 (-0700) Subject: Fix crash when output-preview-framework is missing X-Git-Tag: release/2.12.3-1~88 X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=commitdiff_plain;h=840936be1b28526ef292b5dae8ae031b4fa587f9;p=lilypond.git Fix crash when output-preview-framework is missing * 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 (cherry picked from commit 27f9029238357e9e3e7938f0667445d5e775e991) --- diff --git a/lily/paper-book.cc b/lily/paper-book.cc index 4307bb03ea..fd519d5d75 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -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 ())); } }