Skip to content

Commit

Permalink
Fixing a crash due to calling [RWHVCocoa attributedSubstringForPropos…
Browse files Browse the repository at this point in the history
…edRange] when there is no focused <input>.

RWHVCocoa::attributedSubstringForProposedRange maybe called when there is no
focused <input>. In such cases, renderWidgetHostView_->GetCompositionInfo() returns
nullptr.

BUG=698672

Review-Url: https://codereview.chromium.org/2732143002
Cr-Commit-Position: refs/heads/master@{#455028}
(cherry picked from commit 8c80b23)

Review-Url: https://codereview.chromium.org/2740743003 .
Cr-Commit-Position: refs/branch-heads/3029@{#65}
Cr-Branched-From: 939b32e-refs/heads/master@{#454471}
  • Loading branch information
ehsan-karamad committed Mar 8, 2017
1 parent 67aa8a7 commit e63f1c2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion content/browser/renderer_host/render_widget_host_view_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3097,7 +3097,10 @@ - (NSAttributedString*)attributedSubstringForProposedRange:(NSRange)range
if (!selection)
return nil;

if (!compositionInfo->range.is_empty()) {
if (compositionInfo && !compositionInfo->range.is_empty()) {
// This method might get called after TextInputState.type is reset to none,
// in which case there will be no composition range information
// (https://crbug.com/698672).
expected_text = &markedText_;
expected_range = compositionInfo->range;
} else {
Expand Down

0 comments on commit e63f1c2

Please sign in to comment.