We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cbb255c commit 44e1673Copy full SHA for 44e1673
src/strings/stdlib_str2num.fypp
@@ -138,9 +138,11 @@ module stdlib_str2num
138
!----------------------------------------------
139
! Verify leading negative
140
sign = 1
141
- if( iachar(s(p:p)) == minus_sign+digit_0 ) then
142
- sign = -1
143
- p = p + 1
+ if(p<=len(s)) then
+ if(iachar(s(p:p)) == minus_sign+digit_0 ) then
+ sign = -1
144
+ p = p + 1
145
+ end if
146
end if
147
v = 0
148
0 commit comments