Fix smart indent

Fix for smart indenting.
Previously smart indent would crash due to NullReferenceException and nothing would happen. Currently it indents when inserting newline from line that ends with left brace and dedents when inserting newline from line that contains right brace.
While the former is OK, the latter does is kinda unfamiliar to me in VS. Looking at the issue tracker I don't think there are any exact plans for smart indenting other than "do it like other languages do it in VS" so I'll try and sketch something more detailed.
(It ought to be private or internal, if possible)