mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-25 19:13:54 +00:00
Guard against accessing file that does not exist.
This commit is contained in:
parent
a41bfe5a18
commit
aa56d875c0
2 changed files with 6 additions and 3 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue