diff options
-rw-r--r-- | src/search.c | 3 | ||||
-rw-r--r-- | tests/testsuite.at | 4 |
2 files changed, 6 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; /* diff --git a/tests/testsuite.at b/tests/testsuite.at index 189fbc1..e33a2c4 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -135,6 +135,10 @@ AT_CHECK([$SCITECO -e "2147483647@S/foo/"], 0, ignore, ignore) AT_CHECK([$SCITECO -e "-2147483648@S/foo/"], 1, ignore, ignore) AT_CLEANUP +AT_SETUP([Search on new empty document]) +AT_CHECK([$SCITECO -e ":@S/foo/\"S(0/0)'"], 0, ignore, ignore) +AT_CLEANUP + AT_SETUP([Memory limiting during spawning]) # This might result in an OOM if memory limiting is not working AT_CHECK([$SCITECO -e "50*1000*1000,2EJ 0,128ED @EC'dd if=/dev/zero'"], 1, ignore, ignore) |