Closed Molez closed 6 years ago
Put a bit more thought into it and a better fix might be to alter the title logic a bit. Currently it appears to work like this.
if defaultTitle is empty -> getTitle -> if raw is null OR no lines start with # return defaultTitle.
Problem is that you already know that defaultTitle is empty in getTitle because that is the only way to get into the block (empty being null in some cases).
I would suggest an alternate logic. Keep the
Then for every file if alwaysUseDefaultTitle is true you just use what ever defaultTitle is since its been safely initialized. If it is false then you just search for a title and if one cannot be found you assign default.
This means that the default logic is that the plugin will always search for a title and if one isn't found it will set it to default. Users can override this by setting alwaysUseDefault to true if they do not want it to search for a title.
If I have time I will put in a pull request for this change.
Thanks for reporting this and good suggestion how it could work.
I have found some time to make a pull request. If there are any issues with it let me know and I will fix them.
This issue has resolved in PR #11 and #13. Merged to master and released years ago.
The plugin throws the titled error when the following exists:
In this case since there is no default title it will attempt to find one in the getTitle method. Since it cannot be found the method returns defaultTitle which is un-initialized and this causes a null pointer exception.
Likely fixed by having defaultTitle set to "".