Skip to content

Commit

Permalink
Fix out of range element access (uplift to 1.72.x) (#26212)
Browse files Browse the repository at this point in the history
Uplift of #26211 (squashed) to beta
  • Loading branch information
brave-builds authored Oct 25, 2024
1 parent c677837 commit eb01c51
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/ai_chat/core/browser/conversation_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,8 @@ void ConversationHandler::ClearErrorAndGetFailedMessage(
DCHECK(!chat_history_.empty());

SetAPIError(mojom::APIError::None);
mojom::ConversationTurnPtr turn = std::move(*chat_history_.end());
chat_history_.erase(chat_history_.end());
mojom::ConversationTurnPtr turn = std::move(chat_history_.back());
chat_history_.pop_back();

OnHistoryUpdate();

Expand Down

0 comments on commit eb01c51

Please sign in to comment.