charm: better error checking in ParseURL

I noticed that some invalid charm URLs were parsing as if they were OK.