Only call data()/length() when self is valid()
Change-Id: Icd9c12a10d2183a5159a3aa7a70e90494e8a8183
This commit is contained in:
@@ -41,9 +41,9 @@ class StringPrinterHelper(object):
|
||||
self.encoding = encoding
|
||||
|
||||
def to_string(self):
|
||||
data = self.data()
|
||||
len = self.length()
|
||||
if self.valid():
|
||||
data = self.data()
|
||||
len = self.length()
|
||||
return self.make_string(data, self.encoding, len)
|
||||
else:
|
||||
return "unintialized %s" % self.typename
|
||||
|
Reference in New Issue
Block a user