aboutsummaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorcloudchamb3r <jizon0123@protonmail.com>2024-10-09 02:27:05 +0900
committerGitHub <noreply@github.com>2024-10-09 01:27:05 +0800
commit2e12343fc4ca96a215d6820c4467b619eaa5cbe9 (patch)
tree6b84845ae449c8892130c14ee600ec5a473b6864 /web_src
parentd6d3c96e6555fc91b3e2ef21f4d8d7475564bb3e (diff)
downloadgitea-2e12343fc4ca96a215d6820c4467b619eaa5cbe9.tar.gz
gitea-2e12343fc4ca96a215d6820c4467b619eaa5cbe9.zip
Add null check for responseData.invalidTopics (#32212)
<img width="553" alt="Screenshot 2024-10-08 at 10 49 10 AM" src="https://github.com/user-attachments/assets/faeef64d-684a-4aba-b7fc-c7c6a0301abe"> `responseData.invalidTopics` can be null but it wasn't handled.
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/features/repo-home.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/web_src/js/features/repo-home.ts b/web_src/js/features/repo-home.ts
index f3e39ddb3c..ed1415d286 100644
--- a/web_src/js/features/repo-home.ts
+++ b/web_src/js/features/repo-home.ts
@@ -60,7 +60,7 @@ export function initRepoTopicBar() {
// how to test: input topic like " invalid topic " (with spaces), and select it from the list, then "Save"
const responseData = await response.json();
lastErrorToast = showErrorToast(responseData.message, {duration: 5000});
- if (responseData.invalidTopics.length > 0) {
+ if (responseData.invalidTopics && responseData.invalidTopics.length > 0) {
const {invalidTopics} = responseData;
const topicLabels = queryElemChildren(topicDropdown, 'a.ui.label');
for (const [index, value] of topics.split(',').entries()) {