forked from qt-creator/qt-creator
Debugger: Avoid potential nullptr access
Item may be a nullptr, so do not access it. Change-Id: I3fdbe30dbbd451027c23c9ed06f08396f0ce215a Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1693,25 +1693,19 @@ bool WatchModel::contextMenuEvent(const ItemViewEvent &ev)
|
|||||||
menu->addMenu(createBreakpointMenu(item, menu));
|
menu->addMenu(createBreakpointMenu(item, menu));
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
addAction(menu, tr("Expand All Children"),
|
addAction(menu, tr("Expand All Children"), item, [this, name = item ? item->iname : QString()] {
|
||||||
item,
|
|
||||||
[this, name = item->iname] {
|
|
||||||
m_expandedINames.insert(name);
|
m_expandedINames.insert(name);
|
||||||
if (auto item = findItem(name)) {
|
if (auto item = findItem(name)) {
|
||||||
item->forFirstLevelChildren([this](WatchItem *child) {
|
item->forFirstLevelChildren(
|
||||||
m_expandedINames.insert(child->iname);
|
[this](WatchItem *child) { m_expandedINames.insert(child->iname); });
|
||||||
});
|
|
||||||
m_engine->updateLocals();
|
m_engine->updateLocals();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addAction(menu, tr("Collapse All Children"),
|
addAction(menu, tr("Collapse All Children"), item, [this, name = item ? item->iname : QString()] {
|
||||||
item,
|
|
||||||
[this, name = item->iname] {
|
|
||||||
if (auto item = findItem(name)) {
|
if (auto item = findItem(name)) {
|
||||||
item->forFirstLevelChildren([this](WatchItem *child) {
|
item->forFirstLevelChildren(
|
||||||
m_expandedINames.remove(child->iname);
|
[this](WatchItem *child) { m_expandedINames.remove(child->iname); });
|
||||||
});
|
|
||||||
m_engine->updateLocals();
|
m_engine->updateLocals();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1724,9 +1718,10 @@ bool WatchModel::contextMenuEvent(const ItemViewEvent &ev)
|
|||||||
true,
|
true,
|
||||||
[this] { copyToClipboard(editorContents()); });
|
[this] { copyToClipboard(editorContents()); });
|
||||||
|
|
||||||
addAction(menu, tr("Copy Current Value to Clipboard"),
|
addAction(menu,
|
||||||
|
tr("Copy Current Value to Clipboard"),
|
||||||
item,
|
item,
|
||||||
[this, name = item->iname] {
|
[this, name = item ? item->iname : QString()] {
|
||||||
if (auto item = findItem(name))
|
if (auto item = findItem(name))
|
||||||
copyToClipboard(item->value);
|
copyToClipboard(item->value);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user