[latexila] Build tools: fix crash on unkwown post processor



commit e0d293779564d76788816733b48c5a8f81cb6773
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Aug 14 23:57:44 2013 +0200

    Build tools: fix crash on unkwown post processor
    
    The problem was due to the rubber post processor which has been removed.
    Now we can see a warning instead of a crash:
    
    ** (latexila:15225): WARNING **: build_tools.vala:179: Impossible to
    load build tools: unknown post processor "rubber"

 src/build_tools.vala |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/build_tools.vala b/src/build_tools.vala
index a634a0b..953b06f 100644
--- a/src/build_tools.vala
+++ b/src/build_tools.vala
@@ -138,7 +138,7 @@ public abstract class BuildTools : GLib.Object
                 return (PostProcessorType) type;
         }
 
-        return_val_if_reached (null);
+        return null;
     }
 
     public static string? get_post_processor_name_from_type (PostProcessorType type)
@@ -230,8 +230,14 @@ public abstract class BuildTools : GLib.Object
                     switch (attr_names[i])
                     {
                         case "postProcessor":
-                            _cur_job.post_processor = get_post_processor_type_from_name (
-                                attr_values[i]);
+                            PostProcessorType? post_processor_type =
+                                get_post_processor_type_from_name (attr_values[i]);
+
+                            if (post_processor_type == null)
+                                throw new MarkupError.INVALID_CONTENT (
+                                    "unknown post processor \"" + attr_values[i] + "\"");
+
+                            _cur_job.post_processor = post_processor_type;
                             break;
 
                         // for compatibility (no longer used)


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