Skip to content

Commit e5ee222

Browse files
committed
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 geany#9 0x0000fffff7c4b354 in configuration_open_default_session () at keyfile.c:1404 geany#10 0x0000fffff7c4dfb0 in load_startup_files (argv=0xffffffffeef8, argc=1) at libmain.c:987 ``` This patch fixes that.
1 parent 9bf5769 commit e5ee222

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/document.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,6 +1266,9 @@ void document_apply_indent_settings(GeanyDocument *doc)
12661266

12671267
void document_show_tab(GeanyDocument *doc)
12681268
{
1269+
if (!doc)
1270+
return;
1271+
12691272
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
12701273
document_get_notebook_page(doc));
12711274

0 commit comments

Comments
 (0)