Skip to content

Commit f12b01d

Browse files
committed
Make sure data is sane before dereference
I was seeing a case where data was being passed in as None and causing an exception. So to be safe, make sure data is a value before calling data.strip()
1 parent 9557323 commit f12b01d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

hwinfo/util/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ def __init__(self, data, regexs=None, seperator=None):
3333
self.set_seperator(seperator)
3434

3535
def set_data(self, data):
36-
self.DATA = data.strip()
36+
if data:
37+
self.DATA = data.strip()
38+
else:
39+
self.DATA = ""
3740

3841
def set_regexs(self, regexs):
3942
if regexs:

0 commit comments

Comments
 (0)