Do not add context node if pattern/block isn't valid. This prevent segfault.