Skip to content

Commit

Permalink
check bmap ranges not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
embetrix committed Dec 19, 2024
1 parent 8dab812 commit f676ce5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions bmap-writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ bmap_t parseBMap(const std::string &filename) {

xmlDocPtr doc = xmlReadFile(filename.c_str(), NULL, 0);
if (doc == NULL) {
std::cerr << "Failed to parse " << filename << std::endl;
return bmapData;
}

Expand Down Expand Up @@ -283,8 +282,8 @@ int main(int argc, const char *argv[]) {
}
auto start = std::chrono::high_resolution_clock::now();
bmap_t bmap = parseBMap(bmapFile);
if (bmap.blockSize == 0) {
std::cerr << "BlockSize not found in BMAP file" << std::endl;
if (bmap.blockSize == 0 || bmap.ranges.empty()) {
std::cerr << "Failed to parse file: " << bmapFile << std::endl;
return 1;
}
int ret = BmapWriteImage(imageFile, bmap, device);
Expand Down

0 comments on commit f676ce5

Please sign in to comment.