A NullPointerException was caused when creating a state tooltip for
state values that are not defined in the XML definition.
This patch avoids the NPE in this case. The state tooltip won't be
shown when this happens.
Change-Id: I07ca75d7bb39d3479c225b4b144e1acc119eae3b
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/68072
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Hudson CI
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
package org.eclipse.tracecompass.tmf.analysis.xml.ui.views.timegraph;
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
int value = tcEvent.getValue();
if (entry.getType() == EntryDisplayType.DISPLAY) {
- Integer index = checkNotNull(stateIndex.get(value));
- String rgb = stateValues.get(index.intValue()).getStateString();
- return rgb;
+ Integer index = stateIndex.get(value);
+ if (index != null) {
+ String rgb = stateValues.get(index.intValue()).getStateString();
+ return rgb;
+ }
}
return null;
}