diff --git a/js/components/MainWindow/index.js b/js/components/MainWindow/index.js index 3f8c6c45..ee96bd0a 100644 --- a/js/components/MainWindow/index.js +++ b/js/components/MainWindow/index.js @@ -51,8 +51,9 @@ export class MainWindow extends React.Component { handleDrop(e) { this.supress(e); const { files } = e.dataTransfer; - // TODO: Move this to an actionCreator - this.props.loadFileFromReference(files[0]); + if (files[0]) { + this.props.loadFileFromReference(files[0]); + } } render() { diff --git a/js/winamp.js b/js/winamp.js index a346c15f..508faa75 100644 --- a/js/winamp.js +++ b/js/winamp.js @@ -34,7 +34,9 @@ class Winamp { ); this.fileInput.addEventListener("change", e => { - this.store.dispatch(loadFileFromReference(e.target.files[0])); + if (e.target.files[0]) { + this.store.dispatch(loadFileFromReference(e.target.files[0])); + } }); if (this.options.initialTrack && this.options.initialTrack.url) {