Fix catalog refresh: handle null fields in AppImageHub feed JSON
This commit is contained in:
@@ -175,15 +175,14 @@ pub fn build_catalog_page(db: &Rc<Database>) -> adw::NavigationPage {
|
||||
let db_bg = Database::open().ok();
|
||||
let result = gio::spawn_blocking(move || {
|
||||
if let Some(ref db) = db_bg {
|
||||
catalog::sync_catalog(db, &catalog::CatalogSource {
|
||||
id: Some(1),
|
||||
name: "AppImageHub".to_string(),
|
||||
url: "https://appimage.github.io/feed.json".to_string(),
|
||||
source_type: catalog::CatalogType::AppImageHub,
|
||||
enabled: true,
|
||||
last_synced: None,
|
||||
app_count: 0,
|
||||
}).map_err(|e| e.to_string())
|
||||
catalog::ensure_default_sources(db);
|
||||
let sources = catalog::get_sources(db);
|
||||
if let Some(source) = sources.first() {
|
||||
catalog::sync_catalog(db, source)
|
||||
.map_err(|e| e.to_string())
|
||||
} else {
|
||||
Err("No catalog sources configured".to_string())
|
||||
}
|
||||
} else {
|
||||
Err("Failed to open database".to_string())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user