Fix case when there is no current selected

This commit is contained in:
Oswaldo Acauan 2017-12-15 16:49:47 -02:00
parent df23e6bbb1
commit 2eb2bbd8ab

View File

@ -129,6 +129,10 @@ const persistPresentationChanges = (oldState, newState, uploadEndpoint) => {
return Promise.resolve(presentations);
})
.then((presentations) => {
if (currentPresentation === undefined) {
return Promise.resolve();
}
// If its a newly uploaded presentation we need to get it from promise result
if (!currentPresentation.conversion.done) {
const currentIndex = presentationsToUpload.findIndex(p => p === currentPresentation);
@ -136,7 +140,7 @@ const persistPresentationChanges = (oldState, newState, uploadEndpoint) => {
}
// skip setting as current if error happened
if (currentPresentation === undefined || currentPresentation.conversion.error) {
if (currentPresentation.conversion.error) {
return Promise.resolve();
}