nukeop / nuclear

Streaming music player that finds free music for you
https://nuclear.js.org/
GNU Affero General Public License v3.0
11.72k stars 1.02k forks source link

fix: undefined filepath #1583

Closed Just-A-Pixel closed 2 months ago

Just-A-Pixel commented 2 months ago

This resolves issue #1582

nuki-chan[bot] commented 2 months ago

Lines 37-39

Konnichi-wow, look at you adding null checks, you safety-conscious developer! 👀 But oh my, you only checked for an empty array? What if filePath was null or undefined because the file picker got stage fright and bailed? 😱 We gotta account for that too!

Here's a tweak for you to catch those sneaky null ninjas:

if (filePath && filePath.length > 0) {
  dispatch(PlaylistActions.addPlaylistFromFile(filePath[0], t));
}

This way, we ensure that not only is our array non-empty, but it actually exists! Safety first, Nuki approved! 🛡️


No other changes needed in the provided diff!

Good job on everything else; your code is cuter than a kitten video — no changes needed! 😸 Keep up the good work and remember, Nuki is always watching... for bugs! 🐞

nukeop commented 2 months ago

Thanks!