mbtyers / riverdist

River Network Distance Computation and Applications
23 stars 1 forks source link

Passing a zero length vector to trimriver throws error #13

Open jsta opened 6 years ago

jsta commented 6 years ago

I would expect the following to return the original network instead of an error:

data(Kenai1)
Kenai1.trim <- trimriver(trim=integer(), rivers=Kenai1)

Error in trimriver(trim = integer(), rivers = Kenai1) : 
  Error - resulting river network has no remaining line segments
In addition: Warning messages:
1: In max(trim, na.rm = T) :
  no non-missing arguments to max; returning -Inf
2: In min(trim, na.rm = T) :
  no non-missing arguments to min; returning Inf
mbtyers commented 1 year ago

Hello, and (many) apologies for missing your messages from >5 years ago!! That's a great catch. I will fix on my branch, I'm assuming that will be easiest.