diff --git a/Ficdown.Parser/Parser/BlockHandler.cs b/Ficdown.Parser/Parser/BlockHandler.cs index c1bda26..f8e202d 100644 --- a/Ficdown.Parser/Parser/BlockHandler.cs +++ b/Ficdown.Parser/Parser/BlockHandler.cs @@ -45,8 +45,11 @@ public Story ParseBlocks(IEnumerable blocks) { // get the story - var storyBlock = blocks.SingleOrDefault(b => b.Type == BlockType.Story); - if(storyBlock == null) throw new FicdownException("No story block found"); + var storyBlocks = blocks.Where(b => b.Type == BlockType.Story); + if(storyBlocks.Count() == 0) throw new FicdownException("No story block found"); + if(storyBlocks.Count() > 1) throw new FicdownException("More than one story block found"); + + var storyBlock = storyBlocks.Single(); Anchor storyAnchor; try diff --git a/Ficdown.Parser/Player/StateManager.cs b/Ficdown.Parser/Player/StateManager.cs index 23805b2..0722fd3 100644 --- a/Ficdown.Parser/Player/StateManager.cs +++ b/Ficdown.Parser/Player/StateManager.cs @@ -44,7 +44,7 @@ get { var scene = _story.Scenes[_story.FirstScene].Where(s => s.Conditions == null); - if(scene == null) + if(scene.Count() == 0) throw new FicdownException(_story.Name, string.Format("Story links to undefined scene: {0}", _story.FirstScene)); if(scene.Count() > 1) throw new FicdownException(_story.Name, string.Format("Story links to scene that is defined more than once: {0}", _story.FirstScene));