From cc54a9822630aea92ca3da0b17fe3d1b6787d432 Mon Sep 17 00:00:00 2001 From: Craig Earls Date: Tue, 25 Feb 2014 14:58:24 -0700 Subject: [PATCH] Prevent NPE when an uninitialized table cell is rendered. --- .../FlightConfigurablePanel.java | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/FlightConfigurablePanel.java b/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/FlightConfigurablePanel.java index 1179c45c5..3ef4fe226 100644 --- a/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/FlightConfigurablePanel.java +++ b/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/FlightConfigurablePanel.java @@ -169,21 +169,23 @@ public abstract class FlightConfigurablePanel v = (Pair) value; - String id = v.getU(); - T component = v.getV(); - label = format(component, id, label ); - setSelected(label, table, isSelected, hasFocus); - return label; - } - } + case 0: { + label.setText(descriptor.format(rocket, (String) value)); + regular(label); + setSelected(label, table, isSelected, hasFocus); + return label; + } + default: { + Pair v = (Pair) value; + if(v!=null){ + String id = v.getU(); + T component = v.getV(); + label = format(component, id, label ); + } + setSelected(label, table, isSelected, hasFocus); + return label; + } + } } private final void setSelected( JComponent c, JTable table, boolean isSelected, boolean hasFocus ) {