@codebrainz > it checks the precondition you were checking originally (in case a caller > calls it with no documents open)
The rest of the code in my PR crashes with a null dereference when this precondition is not met. With an assertion, it would crash just the same, except possibly with a message to the console. So I just don’t see how an assertion would be useful, other than making it potentially slightly easier for a future developer to find out why Geany is suddenly dumping core. Whereas my intent with the original `if (doc)` check was to avoid crashing Geany at all if the precondition is violated — for the sake of the end user, not a potential future developer. And *there* in fact an assertion or a warning might make sense, precisely because a potential problem would otherwise be silently passed over. I’m not a real C programmer so please forgive me if I’m missing something obvious here. (Is GDB such a PITA that we want to avoid it wherever possible?) -- 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-315496987
