BZ-1082111 - NPE when sub-process handles an error code exception

(cherry picked from commit bdc93de85e67a68c5fb9684eb4bf449f8b5e7323)