[PATCH 2/3] Fix: crash ao abrir uma declaração totalmente nova

camponez en eduardoelias.com camponez en eduardoelias.com
Vie Mar 20 13:52:13 UTC 2015


From: Eduardo Elias <camponez em gmail.com>

---
 src/form.py    | 2 +-
 src/quadros.py | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/form.py b/src/form.py
index d1dc4ba..7bbb86b 100644
--- a/src/form.py
+++ b/src/form.py
@@ -45,7 +45,7 @@ class OptionsForm(BaseForm):
         self.value = value
         self.index = self.find_index()
     def find_index(self):
-        if self.value == None:
+        if not self.value:
             return -1
         return map(lambda x: x[0], self.options).index(self.value)
     def get_length(self):
diff --git a/src/quadros.py b/src/quadros.py
index 216f11c..235cf4d 100644
--- a/src/quadros.py
+++ b/src/quadros.py
@@ -34,6 +34,7 @@ class Quadros:
     def __init__(self, el, subels):
         self.quadros = []
         for i in subels:
-            self.quadros.append(Quadro(i[0], el.getElementsByTagName(i[1])[0]))
+            if el.getElementsByTagName(i[1]):
+                self.quadros.append(Quadro(i[0], el.getElementsByTagName(i[1])[0]))
 
 # vim:tabstop=4:expandtab:smartindent
-- 
2.3.3.377.gdac1145



Más información sobre la lista de distribución Softwares-impostos