tmf: Fix NPE when zooming out to full trace
authorPatrick Tasse <patrick.tasse@gmail.com>
Fri, 5 Jul 2013 15:00:51 +0000 (11:00 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 9 Jul 2013 18:50:48 +0000 (14:50 -0400)
Blame Sonar!

Change-Id: I85d895f564984c221c588108b0400cb7af6f0b1d
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/14319
Tested-by: Hudson CI
IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java

index a56ecbd5e059c93a082af916a9dec69d75cbe106..f338cdbcee386c901c3aebd9d5d6e7fcc08eba52 100644 (file)
@@ -187,7 +187,12 @@ public class TimeGraphEntry implements ITimeGraphEntry {
      *            The list of time events
      */
     public void setEventList(List<ITimeEvent> eventList) {
-        fEventList = new ArrayList<ITimeEvent>(eventList);
+        if (eventList != null) {
+            fEventList = new ArrayList<ITimeEvent>(eventList);
+        } else {
+            // the event list should never be null
+            fEventList = new ArrayList<ITimeEvent>();
+        }
     }
 
     /**
@@ -199,7 +204,12 @@ public class TimeGraphEntry implements ITimeGraphEntry {
      *            The list of time events
      */
     public void setZoomedEventList(List<ITimeEvent> eventList) {
-        fZoomedEventList = new ArrayList<ITimeEvent>(eventList);
+        if (eventList != null) {
+            fZoomedEventList = new ArrayList<ITimeEvent>(eventList);
+        } else {
+            // the zoomed event list can be null
+            fZoomedEventList = null;
+        }
     }
 
     /**
This page took 0.025995 seconds and 5 git commands to generate.