From 890d5e45ee7faac9881d9340533261a30eb001f9 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Thu, 30 Sep 2021 22:28:37 +0300 Subject: [PATCH] Browser: Check m_console_client is non-null before dereferencing it This added check matches CientConnection::js_console_input and makes sure the webcontent process doesn't crash if the console is opened while no page is available (like in a file not found situation) --- Userland/Services/WebContent/ClientConnection.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Services/WebContent/ClientConnection.cpp b/Userland/Services/WebContent/ClientConnection.cpp index b9a4d25e44..7456cc2e07 100644 --- a/Userland/Services/WebContent/ClientConnection.cpp +++ b/Userland/Services/WebContent/ClientConnection.cpp @@ -317,7 +317,8 @@ void ClientConnection::run_javascript(String const& js_source) void ClientConnection::js_console_request_messages(i32 start_index) { - m_console_client->send_messages(start_index); + if (m_console_client) + m_console_client->send_messages(start_index); } Messages::WebContentServer::GetSelectedTextResponse ClientConnection::get_selected_text()