Skip to content

Commit

Permalink
[#122][Flashcards/JavaScript] Avoid an idempotent log error message.
Browse files Browse the repository at this point in the history
It doesn't have any impact, besides a harmless error message:
```
TypeError: Cannot read properties of null (reading 'split')
```
Still, it's cleaner to avoid it.
  • Loading branch information
pishoyg committed Aug 11, 2024
1 parent 8a57a3a commit b7a9259
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions flashcards/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@
btn.classList.add('hover-link');
btn.onclick = () => { dialect(btn.innerHTML); };
});
(new URLSearchParams(window.location.search)).get('d').split(',').forEach(
dialect);
d = (new URLSearchParams(window.location.search)).get('d');
if (d !== undefined) {
d.split(',').forEach(dialect);
}
"""

CRUM_CSS = """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ window.addEventListener("load", function() {
btn.classList.add('hover-link');
btn.onclick = () => { dialect(btn.innerHTML); };
});
(new URLSearchParams(window.location.search)).get('d').split(',').forEach(
dialect);
d = (new URLSearchParams(window.location.search)).get('d');
if (d !== undefined) {
d.split(',').forEach(dialect);
}
});

0 comments on commit b7a9259

Please sign in to comment.