Selaa lähdekoodia

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

Stefan Schmidt 5 vuotta sitten
vanhempi
commit
a7c1534a3d
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  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:
             # This function call is valid only if there is a statistics object available.
             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))
             if 0 <= int(value) <= self.statistics.get_packet_count() and ts >= 0: