fix: 修复默认程序设置失败的问题

指针初始化未置空,导致的判断出错

Log: 修复默认程序设置失败的问题
Influence: 默认程序设置
Task: https://pms.uniontech.com/task-view-235759.html
Change-Id: Ieb4d7ad1a41e9200447cff7470541461e7129bfb
This commit is contained in:
ssk-wh
2023-01-09 16:45:23 +08:00
parent f93a522546
commit b9372feb9a
3 changed files with 5 additions and 5 deletions

View File

@ -219,7 +219,7 @@ std::vector<std::string> AppInfoManger::getAppList(std::string mimeType)
}
bool AppInfoManger::getDefaultApp(std::string mimeType, std::string desktopId)
bool AppInfoManger::setDefaultApp(std::string mimeType, std::string desktopId)
{
GDesktopAppInfo* gDesktopAppInfo = g_desktop_app_info_new(desktopId.c_str());
@ -229,7 +229,7 @@ bool AppInfoManger::getDefaultApp(std::string mimeType, std::string desktopId)
GAppInfo* gAppInfo = G_APP_INFO(gDesktopAppInfo);
GError* err;
GError* err = nullptr;
g_app_info_set_as_default_for_type(gAppInfo, mimeType.c_str(), &err);
if (err != nullptr) {

View File

@ -16,7 +16,7 @@ public:
static std::shared_ptr<AppInfoManger> loadByDesktopId(std::string desktopId);
static std::string getDefaultApp(std::string mimeType, bool supportUri);
static std::vector<std::string> getAppList(std::string mimeType);
static bool getDefaultApp(std::string mimeType, std::string desktopId);
static bool setDefaultApp(std::string mimeType, std::string desktopId);
static std::vector<std::string>& getXdgDataDirs();
static std::vector<std::string>& getXdgAppsDirs();
static std::vector<std::shared_ptr<AppInfoManger>> getAll(std::map<std::string, std::vector<std::string>> skipDirs);