diff --git a/src/components/ViewerInfo.js b/src/components/ViewerInfo.js index e9ec8a8175ca03ee8925ab0d86f3670636dc2cc9..2ecf5a46c8ee23f917e2234add07dec821730f82 100644 --- a/src/components/ViewerInfo.js +++ b/src/components/ViewerInfo.js @@ -18,6 +18,8 @@ export class ViewerInfo extends Component { t, } = this.props; + if (canvasCount === 0) return ''; + return ( <div className={classNames(ns('osd-info'), classes.osdInfo)}> <Typography display="inline" variant="caption" className={ns('canvas-count')}> diff --git a/src/state/selectors/canvases.js b/src/state/selectors/canvases.js index 62536af904b73206793be7a1abd57864557f5811..f55f59a382eae1227f3d049082b990344abdcd15 100644 --- a/src/state/selectors/canvases.js +++ b/src/state/selectors/canvases.js @@ -6,7 +6,7 @@ import { getWindow, getWindowViewType } from './windows'; export const getCanvases = createSelector( [getManifestoInstance], - manifest => manifest && manifest.getSequences()[0].getCanvases(), + manifest => manifest && manifest.getSequences()[0] && manifest.getSequences()[0].getCanvases(), ); /** @@ -24,7 +24,7 @@ export const getCanvas = createSelector( (state, { canvasId }) => canvasId, ], (manifest, canvasIndex, canvasId) => { - if (!manifest) return undefined; + if (!manifest || !manifest.getSequences()[0]) return undefined; if (canvasId !== undefined) return manifest.getSequences()[0].getCanvasById(canvasId); return manifest.getSequences()[0].getCanvasByIndex(canvasIndex); @@ -37,7 +37,7 @@ export const getCurrentCanvas = createSelector( getWindow, ], (manifest, window) => { - if (!manifest || !window) return undefined; + if (!manifest || !window || !manifest.getSequences()[0]) return undefined; if (!window.canvasId) return manifest.getSequences()[0].getCanvasByIndex(0); diff --git a/src/state/selectors/manifests.js b/src/state/selectors/manifests.js index 8e45104ffe0e246cf36ded4cbd838e8e7495d86a..2b5bdff22728e1281c42b08cdc5afe961bac7627 100644 --- a/src/state/selectors/manifests.js +++ b/src/state/selectors/manifests.js @@ -376,7 +376,7 @@ export function getManifestStartCanvas(json, canvasIndexFromState) { const manifest = createManifestoInstance(json); - if (!manifest) return {}; + if (!manifest || !manifest.getSequences()[0]) return {}; if (canvasIndexFromState !== undefined) { return manifest.getSequences()[0].getCanvasByIndex(canvasIndexFromState); @@ -421,8 +421,9 @@ export const getManifestViewingDirection = createSelector( [getManifestoInstance], (manifest) => { if (!manifest) return null; - const viewingDirection = manifest.getSequences()[0].getViewingDirection() - || manifest.getViewingDirection(); + const viewingDirection = ( + manifest.getSequences()[0] && manifest.getSequences()[0].getViewingDirection() + ) || manifest.getViewingDirection(); if (viewingDirection) return viewingDirection.value; return null; },