Add undefined check for changeComments in gr-file-list
Change-Id: I9d2dc1ce3f7dbe5a3a374565a8af5c1b6fcc6a25
diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts
index 23c0e14..9dcb67e 100644
--- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts
+++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts
@@ -677,7 +677,8 @@
patchRange?: PatchRange,
file?: NormalizedFileInfo
) {
- const draftCount = changeComments?.computeDraftCountForFile(
+ if (changeComments === undefined) return '';
+ const draftCount = changeComments.computeDraftCountForFile(
patchRange,
file
);
@@ -693,7 +694,8 @@
patchRange?: PatchRange,
file?: NormalizedFileInfo
) {
- const draftCount = changeComments?.computeDraftCountForFile(
+ if (changeComments === undefined) return '';
+ const draftCount = changeComments.computeDraftCountForFile(
patchRange,
file
);