aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2024-09-17 17:29:58 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2024-09-17 17:29:58 +0200
commit638f63ce8af4c398aab30a8bf71d30369d229c83 (patch)
treebe297320b402c131cd8512b501c04a337259fd32 /src
parent59b5711a15a924f8ba0e233bce9de1091364c203 (diff)
downloadsciteco-638f63ce8af4c398aab30a8bf71d30369d229c83.tar.gz
fixed searches on completely new and empty documents
This was throwing glib assertions.
Diffstat (limited to 'src')
-rw-r--r--src/search.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/search.c b/src/search.c
index bdf70b0..ed3a00c 100644
--- a/src/search.c
+++ b/src/search.c
@@ -466,7 +466,8 @@ static gboolean
teco_do_search(GRegex *re, gsize from, gsize to, gint *count, GError **error)
{
g_autoptr(GMatchInfo) info = NULL;
- const gchar *buffer = (const gchar *)teco_interface_ssm(SCI_GETRANGEPOINTER, from, to-from);
+ /* NOTE: can return NULL pointer for completely new and empty documents */
+ const gchar *buffer = (const gchar *)teco_interface_ssm(SCI_GETRANGEPOINTER, from, to-from) ? : "";
GError *tmp_error = NULL;
/*