Fix possible null pointer dereference. (#10373)
NodeInfo::p_node was used directly but it can be null from here:
https://github.com/microsoft/onnxruntime/blob/2afce4830c9ff48374ca11cf00b09afcc1ff2124/onnxruntime/core/framework/session_state_utils.cc#L381-L382
Add an additional check that it is not null before use.