summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2012-06-29 12:20:27 +0200
committerFlorian Bruhin <me@the-compiler.org>2012-06-29 12:20:27 +0200
commita8cbd5ed71312ae3cede82d48cfcb00311754418 (patch)
tree443891f2b00e797fe9e768809576abe2817887d4
parentb4c585ab2acc1b2a9c3f0bf63d8e6c365ad773b0 (diff)
downloadxdd2esi-a8cbd5ed71312ae3cede82d48cfcb00311754418.tar.gz
xdd2esi-a8cbd5ed71312ae3cede82d48cfcb00311754418.zip
Set length to 1 for strings without default value
-rw-r--r--xddlib.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/xddlib.py b/xddlib.py
index 6c90e73..3269ef9 100644
--- a/xddlib.py
+++ b/xddlib.py
@@ -163,7 +163,10 @@ def _set_string_length(obj):
elif obj.datatype.type_ == 'unicode':
basesize = 16
default = obj.default
- length = len(default) + 1
+ try:
+ length = len(default) + 1
+ except TypeError:
+ length = 1
size = basesize * length
obj.datatype.length = length
obj.datatype.size = size