ikarago / Notepad

A Fluent-style Notepad-application because Microsoft doesn't make it.
MIT License
118 stars 14 forks source link

Ctrl+H to Share will cause a crash if the document is empty #31

Closed prayaas-a closed 5 years ago

prayaas-a commented 5 years ago

Basically the title. There isn't a nullcheck where there should be one. It's a quick fix that I've been looking at. If you assign this to me, I can take care of it and create a pull request. :)

prayaas-a commented 5 years ago

Commit a2fbd1c adds a nullcheck in GetShareStorageFiles() and assigns an empty string to Data.Text if it's null. This mimics the behavior of a document that once contained text that was now deleted - the app lets them share the empty "edited" document. Likewise, with this change, it'll allow users to share a blank document right off the bat for whatever reason they would want to. It's less intrusive than a popup telling them they can't do that or a silent failure that might make the shortcut trigger seem inconsistent.

prayaas-a commented 5 years ago

This is a pretty "safe" fix in that it shouldn't affect any other functionality or cause regression issues.

Note for the future: If you keep this behavior, you might wanna make sure Data and Data.Text are always initialized on launch and not null. It may help resolve a myriad other bugs similar to this one that we haven't discovered yet.

ikarago commented 5 years ago

Awesome UX thinking with this fix! 😊 I've merged your fix into the master branch in commit 48e8794.

I'll look into your note for the future, as I'm getting a ton of XAML Initialization Crash reports in the Dev Center from which I haven't been able to pinpoint it's exact cause yet. I'll make a separate issue for the initialization issues to keep track of the status of that problem. ;)