Skip to content

Commit

Permalink
Merge pull request serilog#1068 from nikolaybobrovskiy/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
nblumhardt authored Nov 27, 2017
2 parents f284f85 + f467dbb commit c5e719f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Serilog/Parsing/MessageTemplateParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,8 @@ static MessageTemplateToken ParsePropertyToken(int startAt, string messageTempla
if (lastDash > 0)
return new TextToken(rawText, first);

var width = lastDash == -1 ?
int.Parse(alignment) :
int.Parse(alignment.Substring(1));

if (width == 0)
var width = 0;
if (!int.TryParse(lastDash == -1 ? alignment : alignment.Substring(1), out width) || width == 0)
return new TextToken(rawText, first);

var direction = lastDash == -1 ?
Expand Down

0 comments on commit c5e719f

Please sign in to comment.