Skip to content

Commit

Permalink
fix: crash caused by nullptr or uninitialized ptr
Browse files Browse the repository at this point in the history
修复由缺失指针初始化或缺失空指针检查导致的崩溃

Log:
  • Loading branch information
BLumia committed Oct 15, 2024
1 parent ac43f6b commit 9256675
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion panels/dock/taskmanager/taskmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void TaskManager::handleWindowAdded(QPointer<AbstractWindow> window)
desktopfile = DESKTOPFILEFACTORY::createById(res.first().data(m_activeAppModel->roleNames().key("desktopId")).toString(), "amAPP");
}

if (!desktopfile->isValied().first) {
if (desktopfile.isNull() || !desktopfile->isValied().first) {
desktopfile = DESKTOPFILEFACTORY::createByWindow(window);
}

Expand Down
2 changes: 1 addition & 1 deletion panels/dock/taskmanager/taskmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private Q_SLOTS:

private:
QScopedPointer<AbstractWindowMonitor> m_windowMonitor;
RoleCombineModel *m_activeAppModel;
RoleCombineModel *m_activeAppModel = nullptr;
};

}
Expand Down

0 comments on commit 9256675

Please sign in to comment.