From e996788ca2bd34d1621d081b99eb6cd7646e931c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BE=AF=E7=BA=A2=E5=8B=8B?= <houhongxun@kylinos.cn>
Date: Mon, 15 Apr 2024 11:37:10 +0800
Subject: [PATCH] peony: fix segment fault when rapidly open windows
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: 侯红勋 <houhongxun@kylinos.cn>
---
 src/windows/main-window.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/windows/main-window.cpp b/src/windows/main-window.cpp
index a010fcf..26840cd 100644
--- a/src/windows/main-window.cpp
+++ b/src/windows/main-window.cpp
@@ -833,6 +833,9 @@ void MainWindow::updateWindowIcon()
 
 void MainWindow::goToUri(const QString &uri, bool addHistory, bool force)
 {
+    if (!getCurrentPage() || !getCurrentPage()->getView())
+	return;
+
     auto viewId = this->getCurrentPage()->getView()->viewId();
 
     if (QString::compare(viewId, "Icon View", Qt::CaseSensitive) == 0) {
-- 
2.43.0

