Check if json-file to be downloaded to device-controller is empty before

starting a download.
This commit is contained in:
Gerhard Hoffmann 2024-02-17 08:04:06 +01:00
parent 7d38cc1269
commit 9b087f62f9

View File

@ -414,7 +414,7 @@ bool Update::downloadJson(enum FileTypeJson type,
QFileInfo fi(jsFileToSendToDC); // max. size of template file is 800 bytes QFileInfo fi(jsFileToSendToDC); // max. size of template file is 800 bytes
if (file.exists()) { if (file.exists()) {
if (file.open(QIODevice::ReadOnly)) { if (file.open(QIODevice::ReadOnly)) {
if (fi.size() <= 800) { if (fi.size() > 0 && fi.size() <= 800) {
QByteArray ba = file.readAll(); QByteArray ba = file.readAll();
// kindOfFile: 1=config, 2=device, 3=cash, 4=serial, 5=time, 6=printer // kindOfFile: 1=config, 2=device, 3=cash, 4=serial, 5=time, 6=printer
// nrOfTemplate=1...32 if kindOfFile==6 // nrOfTemplate=1...32 if kindOfFile==6