gst-stats: Fix missing NULL checks
Not sure if this is the best way to solve the issue, but works.
gst-inspect-1.0 segfaults on tracing logs where it fails to find element stats. So on the pipelines where we get the following WARNING during execution will afterwards crash with a segfault as the g_ptr_array has a index for it but it is just a NULL pointer.
WARN default gst-stats.c:444:do_message_stats: no element stats found for ix=X
An example of an pipeline which can reproducibly create a trace log where this occurs would be this
GST_DEBUG="GST_TRACER:7" GST_TRACERS="stats;rusage;latency" gst-launch-1.0 videotestsrc num-buffers=120 ! autovideosink &> trace.log
gst-stats-1.0 trace.log