[gedit-latex] DocumentPrefs bug fixes



commit ab74dc4a4215646e5b91d359aa3d191165026165
Author: John Stowers <john stowers gmail com>
Date:   Wed Aug 17 23:20:18 2011 +1200

    DocumentPrefs bug fixes

 latex/latex/validator.py      |    5 ++++-
 latex/preferences/__init__.py |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/latex/latex/validator.py b/latex/latex/validator.py
index 65c5199..7f6f695 100644
--- a/latex/latex/validator.py
+++ b/latex/latex/validator.py
@@ -241,7 +241,10 @@ class LaTeXValidator(object):
                         issue_handler.issue(Issue("Malformed command", node.start, node.lastEnd, node.file, Issue.SEVERITY_ERROR))
 
                 elif node.value in self._extra_issue_commands:
-                    text = node.firstOfType(Node.MANDATORY_ARGUMENT).innerText
+                    try:
+                        text = node.firstOfType(Node.MANDATORY_ARGUMENT).innerText
+                    except IndexError:
+                        text = node.value
                     issue_handler.issue(Issue(text, node.start, node.lastEnd, node.file, Issue.SEVERITY_TASK))
 
             if recurse:
diff --git a/latex/preferences/__init__.py b/latex/preferences/__init__.py
index ea6d18b..ff1fdb1 100644
--- a/latex/preferences/__init__.py
+++ b/latex/preferences/__init__.py
@@ -151,7 +151,10 @@ class DocumentPreferences(_Preferences):
             LOG.debug("Get document pref: %s (modelines: %s)" % (key,",".join(self._modelines.keys())))
             return self._modelines.get(key, self._cp.get(key))
         else:
-            return self._sysprefs.get(key)
+            try:
+                return self._sysprefs.get(key)
+            except KeyError:
+                return None
 
     def set(self, key, value):
         if self._is_docpref(key):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]