mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-09-10 15:50:15 -04:00
fix open external zim
Check if the parameter `pathToSave` is empty before use it otherwise the book path is empty too, which causes crash on opening external zim files
This commit is contained in:
parent
8fc42558d3
commit
0586ef6d41
@ -175,7 +175,7 @@ std::string Manager::addBookFromPathAndGetId(const std::string& pathToOpen,
|
|||||||
kiwix::Book book;
|
kiwix::Book book;
|
||||||
|
|
||||||
if (this->readBookFromPath(pathToOpen, &book)) {
|
if (this->readBookFromPath(pathToOpen, &book)) {
|
||||||
if (pathToSave != pathToOpen) {
|
if (!pathToSave.empty() && pathToSave != pathToOpen) {
|
||||||
book.setPath(isRelativePath(pathToSave)
|
book.setPath(isRelativePath(pathToSave)
|
||||||
? computeAbsolutePath(
|
? computeAbsolutePath(
|
||||||
removeLastPathElement(writableLibraryPath),
|
removeLastPathElement(writableLibraryPath),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user