ID:2645392
 
Resolved
Calling replacetext() with a starting position greater than the length of the text could cause a crash.
BYOND Version:513.1539
Operating System:Windows 10 Pro 64-bit
Web Browser:Chrome 87.0.4280.101
Applies to:Dream Daemon
Status: Resolved (513.1540)

This issue has been resolved.
Descriptive Problem Summary:
If you use replacetext with a start value greater than the length of it's haystack value, the game crashes.

It has to be two or more characters greater. When it's only one, there is no crash.

Numbered Steps to Reproduce Problem:
1 - Use replacetext with the start value greater than the haystack length
2 - Crash


Code Snippet (if applicable) to Reproduce Problem:
replacetext("aaabbb","bbb","aaa",8)


Literally just run this

Expected Results:
No crash

Actual Results:
Crash
Does the problem occur:
Every time? Or how often? Every time
In other games? Yes
In other user accounts? Yes
On other computers? Yes

When does the problem NOT occur? Never

Workarounds: Do a Length check beforehand

Lummox JR resolved issue with message:
Calling replacetext() with a starting position greater than the length of the text could cause a crash.