> I still do not quite understand how an assertion would be useful here, so I 
> chose not to add it; hope that’s OK.

As I said, I don't think the `NULL` check for `doc` is even harmful (ie. the 
original code was fine), but @kugel- didn't think it was necessary and you did. 
An assertion here gives the best of both cases, it checks the precondition you 
were checking originally (in case a caller calls it with no documents open), 
but it compiles away to nothing for release builds since it's impossible to 
fire during a correct run (ie. the GUI prevents it). For more information [see 
here](https://en.wikipedia.org/wiki/Assertion_(software_development)#Assertions_during_the_development_cycle)

-- 
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-315494677

Reply via email to