From da26a65b4d0d767ac3ad44dad79cedc195dc918d Mon Sep 17 00:00:00 2001
From: srichman333 <sarah_n_richman@brown.edu>
Date: Sun, 5 May 2024 13:59:55 -0400
Subject: bug fixed - when piechart has no data

---
 src/client/views/nodes/DataVizBox/components/PieChart.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/client/views/nodes/DataVizBox/components/PieChart.tsx')

diff --git a/src/client/views/nodes/DataVizBox/components/PieChart.tsx b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
index 3819c2f82..5c341e0b4 100644
--- a/src/client/views/nodes/DataVizBox/components/PieChart.tsx
+++ b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
@@ -97,9 +97,9 @@ export class PieChart extends ObservableReactComponent<PieChartProps> {
             { fireImmediately: true }
         );
         // restore selected slices
-        let key = Object.keys(this._pieChartData[0])[0]
         var svg = this._piechartSvg;
-        if (svg) {
+        if (svg && this._pieChartData[0]) {
+            let key = Object.keys(this._pieChartData[0])[0]
             const selectedDataBars = StrListCast(this._props.layoutDoc.dataViz_pie_selectedData)
             svg.selectAll('path').attr('class', (d: any) => {
                 let selected = false;
-- 
cgit v1.2.3-70-g09d2

