From f0ce4f221b64d091595205631a08d5567ba00343 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 25 Nov 2001 15:43:08 +0000 Subject: [PATCH] Irssi::printformat() doesn't crash anymore if you try to use unregistered format. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2143 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/perl/ui/Themes.xs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/perl/ui/Themes.xs b/src/perl/ui/Themes.xs index 99f1fc78..568a8f54 100644 --- a/src/perl/ui/Themes.xs +++ b/src/perl/ui/Themes.xs @@ -6,11 +6,16 @@ void printformat_perl(TEXT_DEST_REC *dest, char *format, char **arglist) char *module, *str; int formatnum; + formatnum = format_find_tag(module, format); + if (formatnum < 0) { + die("printformat(): unregistered format '%s'", format); + return; + } + module = g_strdup(perl_get_package()); theme = dest->window->theme == NULL ? current_theme : dest->window->theme; - formatnum = format_find_tag(module, format); signal_emit("print format", 5, theme, module, &dest, GINT_TO_POINTER(formatnum), arglist);