diff --git a/src/NiivueMutator.ts b/src/NiivueMutator.ts index b654def..a46bfd2 100644 --- a/src/NiivueMutator.ts +++ b/src/NiivueMutator.ts @@ -58,7 +58,15 @@ class NiivueMutator { */ const setter = this.optionUpdateFunctionMap[key]; if (setter !== undefined) { - setter(value); + try { + setter(value); + } catch (e) { + if (e instanceof Error && e.message === 'this.crosshairs3D is null') { + console.warn('Caught error which was fixed in https://github.com/niivue/niivue/pull/864, please update Niivue.'); + } else { + throw e; + } + } } else if (key in this.nv.opts) { // @ts-ignore this.nv.opts[key] = value; diff --git a/src/setters.ts b/src/setters.ts index 1985252..3f49a28 100644 --- a/src/setters.ts +++ b/src/setters.ts @@ -13,7 +13,6 @@ type OptionUpdateFunctionMap = { */ function optionUpdateFunctionMap(nv: Niivue): OptionUpdateFunctionMap { const mapping = { - // FIXME nv.setCrosshairWidth and nv.setCrosshairColor should NOT be called if nv.crosshairs3D is null! crosshairWidth: nv.setCrosshairWidth, crosshairColor: nv.setCrosshairColor, sliceType: nv.setSliceType,