diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2014-10-11 17:05:39 +0000 |
|---|---|---|
| committer | Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl> | 2014-10-11 17:05:39 +0000 |
| commit | 60aeb869a2fe7980724b933484cb871c72078ca6 (patch) | |
| tree | 9fc4e10433fb4042fb0b80468a0609bf9157078d | |
| parent | Apply cx, cy, etc. from template to newly created document window. (diff) | |
| download | inkscape-60aeb869a2fe7980724b933484cb871c72078ca6.tar.gz inkscape-60aeb869a2fe7980724b933484cb871c72078ca6.zip | |
Fix "Argument with 'nonnull' attribute passed null" API bug in extension color parameter construction.
Clang static analyzer has found an "Argument with 'nonnull' attribute passed null".
The applied fix here checks if the defaulthex argument is nullptr before making the call. A default initialization value is added to the constructor in case defaulthex == nullptr.
(with additional whitespace improvements)
(bzr r13587)
| -rw-r--r-- | src/extension/param/color.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp index 0a2598c56..5bd70359f 100644 --- a/src/extension/param/color.cpp +++ b/src/extension/param/color.cpp @@ -59,9 +59,10 @@ guint32 ParamColor::set( guint32 in, SPDocument * /*doc*/, Inkscape::XML::Node * return _value; } -ParamColor::ParamColor (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : - Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), - _changeSignal(0) +ParamColor::ParamColor(const gchar *name, const gchar *guitext, const gchar *desc, const Parameter::_scope_t scope, + bool gui_hidden, const gchar *gui_tip, Inkscape::Extension::Extension *ext, + Inkscape::XML::Node *xml) + : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(0), _changeSignal(0) { const char * defaulthex = NULL; if (xml->firstChild() != NULL) @@ -75,7 +76,8 @@ ParamColor::ParamColor (const gchar * name, const gchar * guitext, const gchar * if (!paramval.empty()) defaulthex = paramval.data(); - _value = atoi(defaulthex); + if (defaulthex) + _value = atoi(defaulthex); } void ParamColor::string(std::string &string) const @@ -87,7 +89,7 @@ void ParamColor::string(std::string &string) const Gtk::Widget *ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * changeSignal ) { - if (_gui_hidden) return NULL; + if (_gui_hidden) return NULL; _changeSignal = new sigc::signal<void>(*changeSignal); Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); |
