Check `e.note` exists before calling `rstrip` on it

Occasionally I get an error about calling `rstrip` on `nil`. I added one of the two `rstrip`s in the code, so sorry if it was me. I'm not really sure how the error comes about, but I've added a check for mine, and I haven't had an error since.