diff src/app/waveform/waveform.component.ts @ 68:f94a9bb319e3

Bail out of rendering if there are no features.
author Lucas Thompson <dev@lucas.im>
date Mon, 19 Dec 2016 14:18:09 +0000
parents 7c34938470fb
children 13955649f5af
line wrap: on
line diff
--- a/src/app/waveform/waveform.component.ts	Fri Dec 16 16:02:27 2016 +0000
+++ b/src/app/waveform/waveform.component.ts	Mon Dec 19 14:18:09 2016 +0000
@@ -176,6 +176,7 @@
       case 'vector': {
         const stepDuration = (features as FixedSpacedFeatures).stepDuration;
         const featureData = (features.data as Float32Array);
+        if (featureData.length === 0) return;
         const normalisationFactor = 1.0 /
           featureData.reduce(
             (currentMax, feature) => Math.max(currentMax, feature),
@@ -202,6 +203,7 @@
       }
       case 'list': {
         const featureData = (features.data as FeatureList);
+        if (featureData.length === 0) return;
         // TODO look at output descriptor instead of directly inspecting features
         const hasDuration = outputDescriptor.configured.hasDuration;
         const isMarker = !hasDuration