From cf7ca05cbd08a12806688c2aaf1918f329c867a4 Mon Sep 17 00:00:00 2001 From: Fedor Glazov Date: Thu, 4 Nov 2021 11:37:26 +0100 Subject: [PATCH] Check if attacker is not None before calling sorties. There is a rare occurence in the logs where a bullet/shell EventHit happens, but no attacker is present. Perhaps a plane shot then disconnected before the hits registered? --- changelog.txt | 6 +++++- readme.txt | 2 +- src/mod_rating_by_type/report.py | 8 +++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index f11d14b..c8b534d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -102,4 +102,8 @@ Version 2.3.0 Version 2.3.1 -- Update to 1.2.57 of IL2 Stats. \ No newline at end of file +- Update to 1.2.57 of IL2 Stats. + +Version 2.3.2 + +- Module Ammo breakdown: Fix rare bug where stats parser would crash if there was a hit registered in the DServer logs with a bullet/shell projectile that did not have an attacker. \ No newline at end of file diff --git a/readme.txt b/readme.txt index 0550a4d..602e74a 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Authors: =FEW=Revolves and Enigma89 This is a mod for IL2 Stats, which adds and changes minor things to the IL2 stats websites. The mod is seperated into modules, which can be turned on and off so you can customize which of the features of the mod you wish to use. Descriptions of the modules follow. -This version of the mod is compatible with version 1.2.57 of IL2 stats. +This version of the mod is compatible with version 1.2.58 of IL2 stats. ------------ Modules which show new information ------------ diff --git a/src/mod_rating_by_type/report.py b/src/mod_rating_by_type/report.py index a042598..d39cec8 100644 --- a/src/mod_rating_by_type/report.py +++ b/src/mod_rating_by_type/report.py @@ -261,9 +261,11 @@ def record_hits(tik, target, attacker, ammo): if attacker and attacker.coal_id == target.coal_id: return - sortie = attacker.sortie - if attacker.parent: - sortie = attacker.parent.sortie + sortie = None + if attacker is not None: + sortie = attacker.sortie + if attacker.parent: + sortie = attacker.parent.sortie if sortie: if not hasattr(sortie, 'ammo_breakdown'):