Commits

Georg Brandl committed 92355db

Do not fail in analyse_text methods (#618).

Comments (0)

Files changed (2)

   * Scss (#509)
   * Duel/JBST
 
+- Do not fail in analyse_text methods (#618).
+
 - Performance improvements in the HTML formatter (#523).
 
 - With the ``noclasses`` option in the HTML formatter, some styles
     returns float values.
     """
     def text_analyse(text):
-        rv = f(text)
+        try:
+            rv = f(text)
+        except Exception:
+            return 0.0
         if not rv:
             return 0.0
-        return min(1.0, max(0.0, float(rv)))
+        try:
+            return min(1.0, max(0.0, float(rv)))
+        except ValueError:
+            return 0.0
     text_analyse.__doc__ = f.__doc__
     return staticmethod(text_analyse)