Skip to content

Commit 16a143c

Browse files
committed
inspector: fix crash when receiving non json message
1 parent a5f3cd8 commit 16a143c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/inspector_io.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,9 @@ std::optional<std::string> InspectorIoDelegate::GetTargetSessionId(
353353
std::string_view view(message.data(), message.size());
354354
std::unique_ptr<protocol::DictionaryValue> value =
355355
protocol::DictionaryValue::cast(JsonUtil::parseJSON(view));
356+
if (!value) {
357+
return std::nullopt;
358+
}
356359
protocol::String target_session_id;
357360
protocol::Value* target_session_id_value = value->get("sessionId");
358361
if (target_session_id_value) {

0 commit comments

Comments
 (0)