From 719eb4a879be759c2853b50f3f30da78e2a66c82 Mon Sep 17 00:00:00 2001
From: wxiaoguang <wxiaoguang@gmail.com>
Date: Fri, 17 Jun 2022 17:44:35 +0800
Subject: [PATCH] Fix a JS error in initRepoCommitLastCommitLoader's entryMap
 (#19996)

---
 web_src/js/features/repo-commit.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/web_src/js/features/repo-commit.js b/web_src/js/features/repo-commit.js
index a911c17392..94fca7a9c2 100644
--- a/web_src/js/features/repo-commit.js
+++ b/web_src/js/features/repo-commit.js
@@ -45,7 +45,12 @@ export function initRepoCommitLastCommitLoader() {
         $('table#repo-files-table .commit-list').replaceWith(row);
         return;
       }
-      entryMap[$(row).attr('data-entryname')].replaceWith(row);
+      // there are other <tr> rows in response (eg: <tr class="has-parent">)
+      // at the moment only the "data-entryname" rows should be processed
+      const entryName = $(row).attr('data-entryname');
+      if (entryName) {
+        entryMap[entryName].replaceWith(row);
+      }
     });
   });
 }