Skip to content

Commit

Permalink
Fixes serilog#1067
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaybobrovskiy authored Nov 27, 2017
1 parent f284f85 commit f467dbb
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 f467dbb

Please sign in to comment.