diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/search.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/search.c b/src/search.c index 2fa8b277195..0e2ae059e81 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -2404,6 +2404,12 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2404 | args_out_of_range (subexp, make_fixnum (search_regs.num_regs)); | 2404 | args_out_of_range (subexp, make_fixnum (search_regs.num_regs)); |
| 2405 | } | 2405 | } |
| 2406 | 2406 | ||
| 2407 | /* Check whether the subexpression to replace is greater than the | ||
| 2408 | number of subexpressions in the regexp. */ | ||
| 2409 | if (sub > 0 && search_regs.start[sub] == -1) | ||
| 2410 | args_out_of_range (build_string ("Attempt to replace regexp subexpression that doesn't exist"), | ||
| 2411 | subexp); | ||
| 2412 | |||
| 2407 | /* Sanity check to see whether the text to replace is present in the | 2413 | /* Sanity check to see whether the text to replace is present in the |
| 2408 | buffer/string. */ | 2414 | buffer/string. */ |
| 2409 | if (NILP (string)) | 2415 | if (NILP (string)) |