Commit 35895035 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

packagekit: Prevent removing SystemUpgrade, don't crash

If the user was gambling his luck by trying to uninstall the "System
Upgrade" entry we create for offline upgrade, now they'll get an error
message rather than a crash.
parent ce290cd3
......@@ -655,6 +655,10 @@ Transaction* PackageKitBackend::installApplication(AbstractResource* app)
Transaction* PackageKitBackend::removeApplication(AbstractResource* app)
{
Q_ASSERT(!isFetching());
if (!qobject_cast<PackageKitResource*>(app)) {
Q_EMIT passiveMessage(i18n("Cannot remove '%1'", app->name()));
return nullptr;
}
return new PKTransaction({app}, Transaction::RemoveRole);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment