Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Does QMenu::addAction return 0 pointer?
Paul Busovikov last edited by
is that code safe?
QAction* a = menu->addAction( "some action" ); a->doSomething();
should I check it before or it is unnecessary?
if ( a ) a->doSomething();
or the same about addMenu
I haven't found mentions about it on http://doc.qt.io/qt-5/qmenu.html
only about actionAt which does return 0
It is unnecessary.
Only in case of out of memory, it could in theory return null but might assert and close
anyway. So would be waste to check as in 99% of all cases it will be added.