Like @codebrainz I think the original is acceptable, its a cheap test of a
return from a function that documents if can return NULL, even if the current
context prevents it, and I agree that it is nice to warn the programmer if we
think of it.
But like @vfaronov I do not think its a good idea to add crashes that may leak
to the user depending on how the distro builds Geany (ie including asserts or
not).
So what about leaving the initial `if (doc)` test so it can't crash, but put:
```
if (!doc)g_critical("@vfaranov was right");
```
before the test so it then logs a message, and can be made fatal by setting the
`G_DEBUG` environment variable. GTK does this lots.
PS any sensible message will do :-D
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1537#issuecomment-315500275