diff --git a/cobalt/webdriver/protocol/window_id.cc b/cobalt/webdriver/protocol/window_id.cc index b63667956cbb..179f724c8968 100644 --- a/cobalt/webdriver/protocol/window_id.cc +++ b/cobalt/webdriver/protocol/window_id.cc @@ -23,8 +23,11 @@ const char kWindowNameKey[] = "name"; base::Optional WindowId::FromValue(const base::Value* value) { const base::Value::Dict* dictionary_value = value->GetIfDict(); - if (!dictionary_value) { - return absl::nullopt; + if (dictionary_value) { + const std::string* window_id = dictionary_value->FindString(kWindowNameKey); + if (window_id) { + return WindowId(*window_id); + } } return base::nullopt; }