bool PluginManager::StepInstall(const std::unique_ptr<AppEventArgs>& args) {
auto* db = dynamic_cast<AppSvcDB*>(GetDB());
+
+ if (db == nullptr) {
+ _E("MetadataPlugin is not prepared");
+ return false;
+ }
for (auto& metadata : args->GetMetadataList()) {
try {
db->Insert(metadata->GetValue(), args->GetAppId());
}
bool PluginManager::StepUninstall(const std::unique_ptr<AppEventArgs>& args) {
+ auto* db = dynamic_cast<AppSvcDB*>(GetDB());
+
+ if (db == nullptr) {
+ _E("MetadataPlugin is not prepared");
+ return false;
+ }
if (args->GetMetadataList().empty()) {
try {
- auto* db = dynamic_cast<AppSvcDB*>(GetDB());
db->Delete(args->GetAppId());
} catch (Exception& e) {
_W("Failed to delete alias info. appid(%s)", args->GetAppId().c_str());
for (auto& metadata : args->GetMetadataList()) {
try {
- auto* db = dynamic_cast<AppSvcDB*>(GetDB());
db->Delete(metadata->GetValue(), args->GetAppId());
} catch (Exception& e) {
return false;
}
bool PluginManager::StepUpgrade(const std::unique_ptr<AppEventArgs>& args) {
+ auto* db = dynamic_cast<AppSvcDB*>(GetDB());
+
+ if (db == nullptr) {
+ _E("MetadataPlugin is not prepared");
+ return false;
+ }
try {
- auto* db = dynamic_cast<AppSvcDB*>(GetDB());
db->Delete(args->GetAppId());
} catch (Exception& e) {
_W("Failed to delete alias info. appid(%s)", args->GetAppId().c_str());