mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-14 08:43:46 +01:00
Fix various issues if database == NULL
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
0e72cbc19a
commit
04d666f61d
@ -601,7 +601,10 @@ document_open(zathura_t* zathura, const char* path, const char* password,
|
|||||||
.position_x = 0,
|
.position_x = 0,
|
||||||
.position_y = 0
|
.position_y = 0
|
||||||
};
|
};
|
||||||
const bool known_file = zathura_db_get_fileinfo(zathura->database, file_path, &file_info);
|
bool known_file = false;
|
||||||
|
if (zathura->database != NULL) {
|
||||||
|
known_file = zathura_db_get_fileinfo(zathura->database, file_path, &file_info);
|
||||||
|
}
|
||||||
|
|
||||||
/* set page offset */
|
/* set page offset */
|
||||||
zathura_document_set_page_offset(document, file_info.page_offset);
|
zathura_document_set_page_offset(document, file_info.page_offset);
|
||||||
@ -823,6 +826,7 @@ document_open(zathura_t* zathura, const char* path, const char* password,
|
|||||||
|
|
||||||
|
|
||||||
/* bookmarks */
|
/* bookmarks */
|
||||||
|
if (zathura->database != NULL) {
|
||||||
if (zathura_bookmarks_load(zathura, file_path) == false) {
|
if (zathura_bookmarks_load(zathura, file_path) == false) {
|
||||||
girara_warning("Failed to loads bookmarks.");
|
girara_warning("Failed to loads bookmarks.");
|
||||||
}
|
}
|
||||||
@ -831,6 +835,7 @@ document_open(zathura_t* zathura, const char* path, const char* password,
|
|||||||
if (zathura_jumplist_load(zathura, file_path) == false) {
|
if (zathura_jumplist_load(zathura, file_path) == false) {
|
||||||
zathura->jumplist.list = girara_list_new2(g_free);
|
zathura->jumplist.list = girara_list_new2(g_free);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* update title */
|
/* update title */
|
||||||
basename_only = false;
|
basename_only = false;
|
||||||
@ -1002,11 +1007,14 @@ document_close(zathura_t* zathura, bool keep_monitor)
|
|||||||
file_info.position_x = zathura_document_get_position_x(zathura->document);
|
file_info.position_x = zathura_document_get_position_x(zathura->document);
|
||||||
file_info.position_y = zathura_document_get_position_y(zathura->document);
|
file_info.position_y = zathura_document_get_position_y(zathura->document);
|
||||||
|
|
||||||
|
if (zathura->database != NULL) {
|
||||||
/* save file info */
|
/* save file info */
|
||||||
zathura_db_set_fileinfo(zathura->database, path, &file_info);
|
zathura_db_set_fileinfo(zathura->database, path, &file_info);
|
||||||
|
|
||||||
/* save jumplist */
|
/* save jumplist */
|
||||||
zathura_db_save_jumplist(zathura->database, path, zathura->jumplist.list);
|
zathura_db_save_jumplist(zathura->database, path, zathura->jumplist.list);
|
||||||
|
}
|
||||||
|
|
||||||
girara_list_iterator_free(zathura->jumplist.cur);
|
girara_list_iterator_free(zathura->jumplist.cur);
|
||||||
zathura->jumplist.cur = NULL;
|
zathura->jumplist.cur = NULL;
|
||||||
girara_list_free(zathura->jumplist.list);
|
girara_list_free(zathura->jumplist.list);
|
||||||
@ -1393,7 +1401,11 @@ zathura_jumplist_add(zathura_t* zathura)
|
|||||||
bool
|
bool
|
||||||
zathura_jumplist_load(zathura_t* zathura, const char* file)
|
zathura_jumplist_load(zathura_t* zathura, const char* file)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(zathura != NULL && zathura->database != NULL && file != NULL, false);
|
g_return_val_if_fail(zathura != NULL && file != NULL, false);
|
||||||
|
|
||||||
|
if (zathura->database == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
zathura->jumplist.list = zathura_db_load_jumplist(zathura->database, file);
|
zathura->jumplist.list = zathura_db_load_jumplist(zathura->database, file);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user