diff --git a/Core/Parsers/EventOccurrenceGrammar.cs b/Core/Parsers/EventOccurrenceGrammar.cs index 7755aa7..81ef9c0 100644 --- a/Core/Parsers/EventOccurrenceGrammar.cs +++ b/Core/Parsers/EventOccurrenceGrammar.cs @@ -112,8 +112,14 @@ public static class EventOccurrenceGrammar var result = SectionHeader.Parse(line); return result; } + catch (Sprache.ParseException) + { + // Expected - line is not a section header, return null + return null; + } catch { + // Unexpected exception, return null to continue parsing return null; } } @@ -129,8 +135,14 @@ public static class EventOccurrenceGrammar GeneralSchedule.Parse(line); return true; } + catch (Sprache.ParseException) + { + // Expected - line is not a General Schedule header + return false; + } catch { + // Unexpected exception, return false to continue parsing return false; } } @@ -184,8 +196,14 @@ public static class EventOccurrenceGrammar var parsed = result.Parse(restOfLine); return parsed; } + catch (Sprache.ParseException) + { + // Expected - line is not a valid occurrence line, return null + return null; + } catch { + // Unexpected exception, return null to continue parsing return null; } }