diff mbox series

include/string: Bail out early on erase

Message ID 20191027054345.13895-1-rosenp@gmail.com
State New
Headers show
Series include/string: Bail out early on erase | expand

Commit Message

Rosen Penev Oct. 27, 2019, 5:43 a.m. UTC
When string is empty.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 include/string | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/include/string b/include/string
index 020c469..abdcc0c 100644
--- a/include/string
+++ b/include/string
@@ -323,6 +323,9 @@  public:
 
 		iterator temp = last;
 
+		if (!count)
+			return first;
+
 		while(last != vector<Ch, A>::end()){
 			*(last - count) = *last;
 			++last;