Browse Source

tools: do not pop an element when the stack is empty

This fixes a Python error in starpu_trace_state_stats.py when the stack
of states is actually empty.
Samuel Pitoiset 9 years ago
parent
commit
e0705a6070
1 changed files with 2 additions and 1 deletions
  1. 2 1
      tools/starpu_trace_state_stats.py

+ 2 - 1
tools/starpu_trace_state_stats.py

@@ -91,7 +91,8 @@ class Worker():
                     if next_event._type == "SetState":
                         break
             elif next_event._type == "PopState":
-                curr_event = self._stack.pop()
+		if not len(self._stack) == 0:
+                    curr_event = self._stack.pop()
 
             # Compute duration with the next event.
             a = curr_event._start_time