QLowEnergyControllerBluez: fix UB (maybe-uninitialized variable)


(may require C++23 and/or -unity-build, to trigger a GCC 14 warning,
though it's pretty clearly function-local)

The compiler detected that, if neither of the two ifs in the loop
hit, the handle variable (a typedef'ed quint16) remains uninit'ed,
yet the following code uses it by adding 1. This is UB. Apparently,
in practice this does not happen, since we always expect either of
the two ifs to hit in at least one of the loop iterations, but
expectations can be broken, so better save than sorry.

Fix by initializing the variable to zero. This doesn't seem to be
very inspired, but at least gets rid of the UB.

Amends 0e367adbfe8e0971930315d1c58b4ef0bf80a9ba, which, however just
replaced similar pre-existing code.

Pick-to: 6.12 6.11 6.8 6.5 5.15
Change-Id: I86b91a9619be0fdf95588f8a609395f2efa59e8b
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
commite6984be7a7a9eee22e517e8d23733e70dfa88b9b
parent1c655ed0b1394e8bd2c4999e20eb767d761ecc80
authorMarc Mutz <marc.mutz@qt.io>
committerMarc Mutz <marc.mutz@qt.io>
commit timeTue, 2 Jun 2026 09:20:38 +0000