Actually threadId should exist, we don't have to check it exist or not. But in bug 870562 threadId will not exist in system message, so we need to check it for avoiding error.