mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-31 09:05:14 +01:00
Propper error handling
This commit is contained in:
parent
4d05b6d667
commit
d769ec4f06
@ -178,8 +178,7 @@ bool AQMMap::readHeader()
|
|||||||
int li = -1;
|
int li = -1;
|
||||||
for (int i = 0; i < files.size(); i++) {
|
for (int i = 0; i < files.size(); i++) {
|
||||||
if (files.at(i).name == "V2HEADER") {
|
if (files.at(i).name == "V2HEADER") {
|
||||||
_file.seek(files.at(i).offset);
|
if (!(_file.seek(files.at(i).offset) && readData(data)))
|
||||||
if (!readData(data))
|
|
||||||
return false;
|
return false;
|
||||||
if (!parseHeader(data, _name))
|
if (!parseHeader(data, _name))
|
||||||
return false;
|
return false;
|
||||||
@ -187,8 +186,7 @@ bool AQMMap::readHeader()
|
|||||||
int zoom, tileSize;
|
int zoom, tileSize;
|
||||||
QRect bounds;
|
QRect bounds;
|
||||||
|
|
||||||
_file.seek(files.at(i).offset);
|
if (!(_file.seek(files.at(i).offset) && readData(data)))
|
||||||
if (!readData(data))
|
|
||||||
return false;
|
return false;
|
||||||
if (!parseLevel(data, zoom, tileSize, bounds))
|
if (!parseLevel(data, zoom, tileSize, bounds))
|
||||||
return false;
|
return false;
|
||||||
@ -344,7 +342,7 @@ QByteArray AQMMap::tileData(const QPoint &tile)
|
|||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
|
|
||||||
size_t offset = z.tiles.value(tile);
|
size_t offset = z.tiles.value(tile);
|
||||||
if (!offset || !_file.seek(offset) || !readData(ba))
|
if (!(offset && _file.seek(offset) && readData(ba)))
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
return ba;
|
return ba;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user