Browse Source

BaseAttack.add_param_value: Throw exception when statistics object is missing and TYPE_PACKET_POSITION is used

Stefan Schmidt 6 years ago
parent
commit
a7c1534a3d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      code/Attack/BaseAttack.py

+ 2 - 2
code/Attack/BaseAttack.py

@@ -414,8 +414,8 @@ class BaseAttack(metaclass=abc.ABCMeta):
         elif param_type == atkParam.ParameterTypes.TYPE_PACKET_POSITION:
         elif param_type == atkParam.ParameterTypes.TYPE_PACKET_POSITION:
             # This function call is valid only if there is a statistics object available.
             # This function call is valid only if there is a statistics object available.
             if self.statistics is None:
             if self.statistics is None:
-                print('Error: Statistics-dependent attack parameter added without setting a statistics object first.')
-                exit(1)
+                raise RuntimeError(
+                    'Error: Statistics-dependent attack parameter added without setting a statistics object first.')
 
 
             ts = pr.pcap_processor(self.statistics.pcap_filepath, "False", Util.RESOURCE_DIR).get_timestamp_mu_sec(int(value))
             ts = pr.pcap_processor(self.statistics.pcap_filepath, "False", Util.RESOURCE_DIR).get_timestamp_mu_sec(int(value))
             if 0 <= int(value) <= self.statistics.get_packet_count() and ts >= 0:
             if 0 <= int(value) <= self.statistics.get_packet_count() and ts >= 0: