Skip to content

Commit 2e12343

Browse files
authored
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.
1 parent d6d3c96 commit 2e12343

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

web_src/js/features/repo-home.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export function initRepoTopicBar() {
6060
// how to test: input topic like " invalid topic " (with spaces), and select it from the list, then "Save"
6161
const responseData = await response.json();
6262
lastErrorToast = showErrorToast(responseData.message, {duration: 5000});
63-
if (responseData.invalidTopics.length > 0) {
63+
if (responseData.invalidTopics && responseData.invalidTopics.length > 0) {
6464
const {invalidTopics} = responseData;
6565
const topicLabels = queryElemChildren(topicDropdown, 'a.ui.label');
6666
for (const [index, value] of topics.split(',').entries()) {

0 commit comments

Comments
 (0)