QBinaryJsonArray: fix Coverity FORWARD_NULL (deref after null check) in append()
Coverity complained that the code checked `a` for nullptr in the
initialization of `i`, but then, in clone(), called via detach(),
unconditionally dereferenced `b` (init'ed from `a`) in `b->size`.
The nullptr check in append() is needed, because `a` _can_ be nullptr
before the detach(). But not after. And a detach() never changes the
length(), so just move the definition of 'i' to after the detach() and
drop the nullptr check.
Amends qtbase/35adb74ddd915831789f0175423660f8e898942e (5.15). I
didn't check whether the previous code had a similar Coverity
complaint, but the Coverity First Detected date is a week after the
amended commit merged, though Coverity is known to renumber issues
when code moves, and said commit moved _a lot_ of code. Luckily, we
don't pick that far anymore, so that question can remain unanswered
here.
Pick-to: 6.12 6.11 6.8
Coverity-Id: 263798
Change-Id: Ia94fa0f588d512d59f5e9bbd6feae41ca4f2bd61
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>