Only call data()/length() when self is valid()

Change-Id: Icd9c12a10d2183a5159a3aa7a70e90494e8a8183
This commit is contained in:
Stephan Bergmann
2013-01-28 12:38:42 +01:00
parent 6d85041943
commit 179c9c4f78

View File

@@ -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