Merge "Check replacement in suggestion"
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
index aaa80e9..bc9bd12 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
@@ -1185,7 +1185,7 @@
hasNewRange: suggestionResponse.suggestions?.[0]?.newRange !== undefined,
});
const suggestion = suggestionResponse.suggestions?.[0];
- if (!suggestion) return;
+ if (!suggestion?.replacement) return;
this.generatedSuggestion = suggestion;
}
@@ -1235,7 +1235,9 @@
numSuggestions: suggestionResponse.fix_suggestions.length,
});
const suggestion = suggestionResponse.fix_suggestions?.[0];
- if (!suggestion) return;
+ if (!suggestion?.replacements || suggestion.replacements.length === 0) {
+ return;
+ }
this.generatedFixSuggestion = suggestion;
this.autoSaveTrigger$.next();
}