Skip to content

Commit 908cdca

Browse files
committed
Handle weird case.
Indeed, in some rare case; or if someone just mess with PyFunceble, the counter index may not be found. This patch fixes it by always checking if the counter index exists. Contributors: * @mitchellkrogza
1 parent 73d59ee commit 908cdca

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

PyFunceble/cli/filesystem/counter.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ def count(self, status: CheckerStatusBase) -> "FilesystemCounter":
228228
f"<status> should be {CheckerStatusBase}, {type(status)} given."
229229
)
230230

231+
if "counter" not in self.dataset:
232+
self.dataset["counter"] = {}
233+
self.dataset["percentage"] = {}
234+
231235
self.dataset["counter"][status.status] += 1
232236
self.dataset["counter"]["total"] += 1
233237

0 commit comments

Comments
 (0)