Skip to content
Snippets Groups Projects
Commit 3e556173 authored by Chris Beer's avatar Chris Beer
Browse files

Guard against manifests without sequences

parent 9ae3262d
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,8 @@ export class ViewerInfo extends Component { ...@@ -18,6 +18,8 @@ export class ViewerInfo extends Component {
t, t,
} = this.props; } = this.props;
if (canvasCount === 0) return '';
return ( return (
<div className={classNames(ns('osd-info'), classes.osdInfo)}> <div className={classNames(ns('osd-info'), classes.osdInfo)}>
<Typography display="inline" variant="caption" className={ns('canvas-count')}> <Typography display="inline" variant="caption" className={ns('canvas-count')}>
......
...@@ -6,7 +6,7 @@ import { getWindow, getWindowViewType } from './windows'; ...@@ -6,7 +6,7 @@ import { getWindow, getWindowViewType } from './windows';
export const getCanvases = createSelector( export const getCanvases = createSelector(
[getManifestoInstance], [getManifestoInstance],
manifest => manifest && manifest.getSequences()[0].getCanvases(), manifest => manifest && manifest.getSequences()[0] && manifest.getSequences()[0].getCanvases(),
); );
/** /**
...@@ -24,7 +24,7 @@ export const getCanvas = createSelector( ...@@ -24,7 +24,7 @@ export const getCanvas = createSelector(
(state, { canvasId }) => canvasId, (state, { canvasId }) => canvasId,
], ],
(manifest, canvasIndex, canvasId) => { (manifest, canvasIndex, canvasId) => {
if (!manifest) return undefined; if (!manifest || !manifest.getSequences()[0]) return undefined;
if (canvasId !== undefined) return manifest.getSequences()[0].getCanvasById(canvasId); if (canvasId !== undefined) return manifest.getSequences()[0].getCanvasById(canvasId);
return manifest.getSequences()[0].getCanvasByIndex(canvasIndex); return manifest.getSequences()[0].getCanvasByIndex(canvasIndex);
...@@ -37,7 +37,7 @@ export const getCurrentCanvas = createSelector( ...@@ -37,7 +37,7 @@ export const getCurrentCanvas = createSelector(
getWindow, getWindow,
], ],
(manifest, window) => { (manifest, window) => {
if (!manifest || !window) return undefined; if (!manifest || !window || !manifest.getSequences()[0]) return undefined;
if (!window.canvasId) return manifest.getSequences()[0].getCanvasByIndex(0); if (!window.canvasId) return manifest.getSequences()[0].getCanvasByIndex(0);
......
...@@ -376,7 +376,7 @@ export function getManifestStartCanvas(json, canvasIndexFromState) { ...@@ -376,7 +376,7 @@ export function getManifestStartCanvas(json, canvasIndexFromState) {
const manifest = createManifestoInstance(json); const manifest = createManifestoInstance(json);
if (!manifest) return {}; if (!manifest || !manifest.getSequences()[0]) return {};
if (canvasIndexFromState !== undefined) { if (canvasIndexFromState !== undefined) {
return manifest.getSequences()[0].getCanvasByIndex(canvasIndexFromState); return manifest.getSequences()[0].getCanvasByIndex(canvasIndexFromState);
...@@ -421,8 +421,9 @@ export const getManifestViewingDirection = createSelector( ...@@ -421,8 +421,9 @@ export const getManifestViewingDirection = createSelector(
[getManifestoInstance], [getManifestoInstance],
(manifest) => { (manifest) => {
if (!manifest) return null; if (!manifest) return null;
const viewingDirection = manifest.getSequences()[0].getViewingDirection() const viewingDirection = (
|| manifest.getViewingDirection(); manifest.getSequences()[0] && manifest.getSequences()[0].getViewingDirection()
) || manifest.getViewingDirection();
if (viewingDirection) return viewingDirection.value; if (viewingDirection) return viewingDirection.value;
return null; return null;
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment