Skip to content

Commit

Permalink
fix: Undoing the breaking introduced by trying to stopp (#2023)
Browse files Browse the repository at this point in the history
* fix: Undoing the breaking introduced by trying to stopp

* add check for exists
  • Loading branch information
Blu-J authored Dec 4, 2022
1 parent d8c39c4 commit 785ed48
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion backend/src/install/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,18 @@ pub async fn download_install_s9pk(
let mut previous_state: Option<MainStatus> = None;

if let Err(e) = async {
previous_state = Some(crate::control::stop_impl(ctx.clone(), pkg_id.clone()).await?);
if crate::db::DatabaseModel::new()
.package_data()
.idx_model(&pkg_id)
.and_then(|x| x.installed())
.exists(&mut ctx.db.handle())
.await
.unwrap_or(false)
{
previous_state = crate::control::stop_impl(ctx.clone(), pkg_id.clone())
.await
.ok();
}
let mut db_handle = ctx.db.handle();
let mut tx = db_handle.begin().await?;
let receipts = DownloadInstallReceipts::new(&mut tx, &pkg_id).await?;
Expand Down

0 comments on commit 785ed48

Please sign in to comment.