From 9ad9202c3d09a6e20e9f4b51698eed9e55065404 Mon Sep 17 00:00:00 2001 From: LiuWei Date: Thu, 27 Mar 2025 15:24:24 +0800 Subject: [PATCH] Fix the Nonetype error when the match fails. Signed-off-by: LiuWei Reported-by: Lan Tian --- source/tools/detect/io/iofsstat/iostatClass.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/tools/detect/io/iofsstat/iostatClass.py b/source/tools/detect/io/iofsstat/iostatClass.py index 9f16ebe8..d288f828 100755 --- a/source/tools/detect/io/iofsstat/iostatClass.py +++ b/source/tools/detect/io/iofsstat/iostatClass.py @@ -121,6 +121,9 @@ class iostatClass(diskstatClass): oneIO = entry.split() matchObj = re.match( r'(.*) \[([^\[\]]*)\] (.*) \[([^\[\]]*)\]\n', entry) + # Fix the NoneType error when the match fails + if not matchObj: + continue comm = matchObj.group(4) pid = matchObj.group(1).rsplit('-', 1)[1].strip() if self.pid is not None and int(pid) != self.pid: -- Gitee