Fix potential invalid-reads in catapult files

As caught by CppCheck, the conditions checking that n is in bounds should
occur *before* the conditions using n as an index so that if n is out of bounds
we don't try and use it anyways.

(cherry picked from commit 72fc075e9a6b3ba79e49668e74a8dd187fc04f8a)

Change-Id: I23de43d52984cb441fa08f5f7384c486c9de817c
Reviewed-on: https://code.wireshark.org/review/4785
Reviewed-by: Guy Harris <guy@alum.mit.edu>