Fix scoping spacing for pragmas and curly braces.
If the writer did not write anything it would throw when attempting to do .Last().
This commit is contained in:
parent
cadc2fc67e
commit
da192d7c96
|
|
@ -57,7 +57,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
|
|||
|
||||
private void TryAutoSpace(string spaceCharacter)
|
||||
{
|
||||
if (_autoSpace && !Char.IsWhiteSpace(_writer.LastWrite.Last()))
|
||||
if (_autoSpace && _writer.LastWrite.Length > 0 && !Char.IsWhiteSpace(_writer.LastWrite.Last()))
|
||||
{
|
||||
_writer.Write(spaceCharacter);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
documentLocation: _documentMapping,
|
||||
generatedLocation: new MappingLocation(_generatedLocation, _generatedContentLength));
|
||||
|
||||
if (_writer.LastWrite.Last() != '\n')
|
||||
if (_writer.ToString().Last() != '\n')
|
||||
{
|
||||
_writer.WriteLine();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue