diff --git a/backend/model/mysql/GalleryManager.ts b/backend/model/mysql/GalleryManager.ts index 86d41092..42f84b92 100644 --- a/backend/model/mysql/GalleryManager.ts +++ b/backend/model/mysql/GalleryManager.ts @@ -44,7 +44,7 @@ export class GalleryManager implements IGalleryManager { cb(null, dir); //WARNING: only on the fly indexing should happen after this point //on the fly updating - this.indexDirectory(relativeDirectoryName, cb); + return this.indexDirectory(relativeDirectoryName, cb); } return this.indexDirectory(relativeDirectoryName, cb); diff --git a/frontend/app/gallery/grid/GridPhoto.ts b/frontend/app/gallery/grid/GridPhoto.ts index db516a64..a7241cbf 100644 --- a/frontend/app/gallery/grid/GridPhoto.ts +++ b/frontend/app/gallery/grid/GridPhoto.ts @@ -27,10 +27,12 @@ export class GridPhoto { this.replacementSizeCache = null; let size = this.getThumbnailSize(); - for (let i = 0; i < this.photo.readyThumbnails.length; i++) { - if (this.photo.readyThumbnails[i] < size) { - this.replacementSizeCache = this.photo.readyThumbnails[i]; - break; + if (!!this.photo.readyThumbnails) { + for (let i = 0; i < this.photo.readyThumbnails.length; i++) { + if (this.photo.readyThumbnails[i] < size) { + this.replacementSizeCache = this.photo.readyThumbnails[i]; + break; + } } } } @@ -42,7 +44,7 @@ export class GridPhoto { } isThumbnailAvailable() { - return this.photo.readyThumbnails.indexOf(this.getThumbnailSize()) != -1; + return this.photo.readyThumbnails && this.photo.readyThumbnails.indexOf(this.getThumbnailSize()) != -1; } getReplacementThumbnailPath() {