Check for null or undefined `subscription`

Instead of null or undefined method `dispose` on it.
Add test for non text editors