Skip to content

Commit

Permalink
Avoid NPE, closes #482
Browse files Browse the repository at this point in the history
  • Loading branch information
RicoSuter committed Sep 21, 2017
1 parent 7268db6 commit 32e056f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/NJsonSchema.CodeGeneration/GeneratorBase.cs
Expand Up @@ -19,14 +19,14 @@ public abstract class GeneratorBase
/// <param name="schema">The schema.</param>
protected GeneratorBase(JsonSchema4 schema)
{
_schema = schema;
_schema = schema;
}

/// <summary>Generates the the whole file containing all needed types.</summary>
/// <returns>The code</returns>
public string GenerateFile()
{
return GenerateFile(Regex.IsMatch(_schema.Title, "^[a-zA-Z0-9_]*$") ? _schema.Title : null);
return GenerateFile(_schema.Title != null && Regex.IsMatch(_schema.Title, "^[a-zA-Z0-9_]*$") ? _schema.Title : null);
}

/// <summary>Generates the the whole file containing all needed types.</summary>
Expand Down

0 comments on commit 32e056f

Please sign in to comment.