Skip to content

Commit

Permalink
Add null check for responseData.invalidTopics (#32212) (#32217)
Browse files Browse the repository at this point in the history
Backport #32212 by @cloudchamb3r

<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.

Co-authored-by: cloudchamb3r <jizon0123@protonmail.com>
  • Loading branch information
GiteaBot and cloudchamb3r authored Oct 9, 2024
1 parent 2e3a191 commit 4815c4a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion web_src/js/features/repo-home.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit 4815c4a

Please sign in to comment.