BZ-1019473: checking for null matches to avoid NPE on 'from' node
(cherry picked from commit affb4e3893d047ccd6eb79eeb2978f2774039cc1)