Skip to content

Commit

Permalink
Fix issues with converting empty strings
Browse files Browse the repository at this point in the history
  • Loading branch information
jtappin committed Oct 4, 2012
1 parent 4f369b4 commit 61c5b76
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/gtk-sup.f90
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 61c5b76

Please sign in to comment.