[umbrello] [Bug 445119] Issues with code ignoring and possibly dereferencing nullptr

"Robert Hairgrove" <[email protected]>
Newsgroups gmane.linux.umbrello.devel
Message-ID <[email protected]/>
https://bugs.kde.org/show_bug.cgi?id=445119

--- Comment #6 from Robert Hairgrove <[email protected]> ---
(In reply to Oliver Kellogg from comment #5)
> (In reply to Robert Hairgrove from comment #0)
> > Using Umbrello from Git/master:
> > 
> > In file "component.cpp" at line 58 in the method
> > "UMLComponent::saveToXMI1()":
> > 
> >   for (UMLObjectListIt objectsIt(m_objects); objectsIt.hasNext();) {
> >       UMLObject* obj = objectsIt.next();
> >       uIgnoreZeroPointer(obj);
> >       obj->saveToXMI1 (writer);
> >   }
> > 
> > What happens if "obj" == nullptr? A warning is emitted by
> > "uIgnoreZeroPointer", but "obj" is dereferenced after that anyway, which
> > causes undefined behavior according to the C++ standard.
> 
> Looking at the definition of uIgnoreZeroPointer, in
> umbrello/debug/debug_utils.h :
> #define uIgnoreZeroPointer(a) if (!a) { uDebug() << "zero pointer detected"
> << __FILE__ << __LINE__; continue; }
> 
> The `continue` statement means that the null pointer will not be accessed.
> 
> Just a minor point... not to detract from the question of why lists contain
> null pointers at all.

Thanks, Oliver -- I didn't see the "continue" statement.

-- 
You are receiving this mail because:
You are the assignee for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.