Fix runtime warning when opening Geany without open files
commite5ee2227807c50604176b73119f9d8c90c6b0e02
authorJiří Techet <techet@gmail.com>
Tue, 2 Jul 2024 08:56:59 +0000 (2 10:56 +0200)
committerJiří Techet <techet@gmail.com>
Tue, 2 Jul 2024 09:08:05 +0000 (2 11:08 +0200)
tree48d7b92e6c2ca881c6b703feba8aeeb7e5011987
parent9bf5769f582cbf3d82a1faca035e7f63e8908afe
Fix runtime warning when opening Geany without open files

When Geany is opened with no open document, the following warning
appears:
```
(geany:1735619): Geany-CRITICAL **: 10:49:58.729: document_get_notebook_child: assertion 'doc != NULL' failed
```

The corresponding stack trace when using `--g-fatal-warnings` is:
```
#5  0x0000fffff7c232c8 in document_get_notebook_child (doc=<optimized out>)
    at document.c:269
#6  0x0000fffff7c24140 in document_get_notebook_page (doc=<optimized out>)
    at document.c:291
#7  0x0000fffff7c25198 in document_show_tab (doc=0x0) at document.c:1269
#8  0x0000fffff7c4b24c in configuration_open_files
    (session_files=<optimized out>) at keyfile.c:1390
#9  0x0000fffff7c4b354 in configuration_open_default_session ()
    at keyfile.c:1404
#10 0x0000fffff7c4dfb0 in load_startup_files (argv=0xffffffffeef8, argc=1)
    at libmain.c:987
```

This patch fixes that.
src/document.c