summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <dpursehouse@collab.net>2019-10-24 23:29:58 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-10-24 23:29:58 +0000
commit69e4a0a79efb20f8dfb3fb6c2d9a59e4cc55793f (patch)
tree1f6eac892e3f7b6ef5e1772367a42c09b77b6aa0
parentc199f37d8f10cf406feb6fcf14e515f53e8fc38b (diff)
parentad987667003690573a21f4b5937d92c6293a284b (diff)
Merge "Add more undefined checks to gr-change-view" into stable-3.1
-rw-r--r--polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
index 4ffcc9bf1b..1627999aaf 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js
@@ -853,7 +853,8 @@
Gerrit.awaitPluginsLoaded()
.then(this._getLoggedIn.bind(this))
.then(loggedIn => {
- if (!loggedIn || this._change.status !== this.ChangeStatus.MERGED) {
+ if (!loggedIn || !this._change ||
+ this._change.status !== this.ChangeStatus.MERGED) {
// Do not display dialog if not logged-in or the change is not
// merged.
return;
@@ -1203,6 +1204,7 @@
},
_getProjectConfig() {
+ if (!this._change) return;
return this.$.restAPI.getProjectConfig(this._change.project).then(
config => {
this._projectConfig = config;
@@ -1317,6 +1319,7 @@
_getLatestCommitMessage() {
return this.$.restAPI.getChangeCommitInfo(this._changeNum,
this.computeLatestPatchNum(this._allPatchSets)).then(commitInfo => {
+ if (!commitInfo) return Promise.resolve();
this._latestCommitMessage =
this._prepareCommitMsgForLinkify(commitInfo.message);
});
@@ -1500,6 +1503,10 @@
},
_getMergeability() {
+ if (!this._change) {
+ this._mergeable = null;
+ return Promise.resolve();
+ }
// If the change is closed, it is not mergeable. Note: already merged
// changes are obviously not mergeable, but the mergeability API will not
// answer for abandoned changes.