Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix issues with converting empty strings

  • Loading branch information...
commit 61c5b76b96e4656def98c694b2474ec374a19a9d 1 parent 4f369b4
@jtappin jtappin authored
Showing with 10 additions and 3 deletions.
  1. +10 −3 src/gtk-sup.f90
View
13 src/gtk-sup.f90
@@ -622,8 +622,12 @@ subroutine convert_f_string_a(f_string, textptr, length)
lcstr = sum(lfstr)
do i = 1, size(f_string)
- if (f_string(i)(lfstr(i):lfstr(i)) /= c_null_char .and. &
- & f_string(i)(lfstr(i):lfstr(i)) /= c_new_line) lcstr = lcstr+1
+ if (lfstr(i) == 0) then
+ lcstr = lcstr+1
+ else if (f_string(i)(lfstr(i):lfstr(i)) /= c_null_char .and. &
+ & f_string(i)(lfstr(i):lfstr(i)) /= c_new_line) then
+ lcstr = lcstr+1
+ end if
end do
allocate(textptr(lcstr))
@@ -663,7 +667,10 @@ subroutine convert_f_string_s(f_string, textptr, length)
logical :: add_null
lcstr = len_trim(f_string)
- if (f_string(lcstr:lcstr) == c_null_char) then
+ if (lcstr == 0) then
+ lcstr = lcstr+1
+ add_null = .true.
+ else if (f_string(lcstr:lcstr) /= c_null_char) then
lcstr = lcstr+1
add_null = .true.
else
Please sign in to comment.
Something went wrong with that request. Please try again.