Segmentation fault when extending occursin to handle missing values

Minimal working example (for both v1.0.3 and v1.1.0):

import Base: occursin

function occursin(needle::String, haystack::Union{String,Missing})
  if !ismissing(haystack)
    return occursin(needle, haystack)
  else
    return false
  end
end

@show occursin("foo", missing) # false
@show occursin("foo", "foobar") # segmentation fault:11 in v1.0.3, bus error: 10 in v1.1.0

Seems to me that this is a bug. However, I’m wondering if there is something wrong as well when trying to extend the function occursin in this way. If I extend the function in the following way, there is no segmentation fault:

import Base: occursin

function occursin(needle::Union{AbstractString,Regex,AbstractChar}, haystack::Union{AbstractString,Missing})
  if !ismissing(haystack)
    return occursin(needle, haystack)
  else
    return false 
  end
end

@show occursin("foo", missing) # false
@show occursin("foo", "foobar") # true

I think it should be stack overflow in the first one because it calls itself indefinetly. The second one is a fallback definition for AbstractString in the first argument. It is just called for haystack::Missing but not for haystack::String since there is already a more specific method for that. Having said that, the second one also cause stack overflow when used as a fallback method for haystack isa AbstractString.