Guard against accessing file that does not exist.

This commit is contained in:
Jordan Eldredge 2017-10-24 20:31:53 -07:00
parent a41bfe5a18
commit aa56d875c0
2 changed files with 6 additions and 3 deletions

View file

@ -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() {

View file

@ -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) {