Lint mode #8

Merged
rudism merged 4 commits from lint-mode into master 2019-05-12 09:50:03 -05:00
2 changed files with 6 additions and 3 deletions
Showing only changes of commit b75a672ce2 - Show all commits

View file

@ -45,8 +45,11 @@
public Story ParseBlocks(IEnumerable<Block> 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

View file

@ -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));