From 4c3acef3fae40e0f9e42f68cc65982e9902413d0 Mon Sep 17 00:00:00 2001 From: twanvl Date: Wed, 21 Jul 2010 19:24:51 +0000 Subject: [PATCH] don't crash when an action=nullptr (partial fix for #20) git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1455 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/data/action/value.cpp | 2 +- src/gui/value/editor.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/data/action/value.cpp b/src/data/action/value.cpp index d674505e..5101587f 100644 --- a/src/data/action/value.cpp +++ b/src/data/action/value.cpp @@ -149,7 +149,7 @@ TextValueAction* toggle_format_action(const TextValueP& value, const String& tag new_value += _(""); new_value += str.substr(end_i); } else { - // we are inside this tag, _('remove') it + // we are inside this tag, 'remove' it new_value = str.substr(0, start_i); new_value += _(""); new_value += str.substr(start_i, end_i - start_i); diff --git a/src/gui/value/editor.cpp b/src/gui/value/editor.cpp index d828b932..296fefd5 100644 --- a/src/gui/value/editor.cpp +++ b/src/gui/value/editor.cpp @@ -13,6 +13,8 @@ // ----------------------------------------------------------------------------- : ValueEditor void ValueEditor::addAction(ValueAction* a) { - a->isOnCard(editor().getCard().get()); - editor().addAction(a); + if (a) { + a->isOnCard(editor().getCard().get()); + editor().addAction(a); + } }