From 435717a3469ebb96ce8b8d30fc50d6151f9cbfbb Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 13 Feb 2017 22:35:48 +0100 Subject: Extensions: Do not require name for pure UI elements (i.e. parameters that do not store a value and therefore do not need to have a name) (bzr r15515) --- src/extension/param/parameter.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/extension/param/parameter.cpp') diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index c8b30863b..9fbe662f7 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -50,10 +50,17 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex const char *name = in_repr->attribute("name"); const char *type = in_repr->attribute("type"); - // In this case we just don't have enough information - if (!name || !type) { + // we can't create a parameter without type + if (!type) { return NULL; } + // also require name unless it's a pure UI element that does not store its value + if (!name) { + static std::vector ui_elements = {"description"}; + if (std::find(ui_elements.begin(), ui_elements.end(), type) == ui_elements.end()) { + return NULL; + } + } const char *guitext = in_repr->attribute("gui-text"); if (guitext == NULL) { -- cgit v1.2.3