Modbus server: fix data conversion error handling


In line
 ok = modbusDevice->setData(..., value.toUShort(&ok, 16));
the value of 'ok' variable after the toUShort() conversion is
immediately overwritten by the return value of setData() method.
As a result, the code could never detect that toUShort() conversion
failed.

This commit splits the line into several independent statements, adding
an if (ok) check in between.

Task-number: QTBUG-110890
Pick-to: 6.5
Change-Id: I98a9275262f5a05fee77905ce7c7d861f2dce6fe
Reviewed-by: André Hartmann <aha_1980@gmx.de>
commit65349283e32a5a0f0bf99469d9e596212a88e623
parent20d4cba63221cb144537518e492187ff82a590fa
authorIvan Solovev <ivan.solovev@qt.io>
committerIvan Solovev <ivan.solovev@qt.io>
commit timeTue, 14 Feb 2023 12:29:36 +0100