Couldn't resist ;-)
The check here
https://github.com/geany/geany/blob/9bf5769f582cbf3d82a1faca035e7f63e8908afe...
isn't right, is it? `documents_array->len` isn't the number of currently open documents - all of them could be invalid (which happens after closing a session). It should either check the number of open tabs in the notebook or do `foreach_document(i) { count++; }` to get the right number.