added null guards to device info

This commit is contained in:
lasan
2026-06-05 10:59:01 +05:30
parent 945406a9f3
commit 84eaf3ef27
2 changed files with 9 additions and 6 deletions
@@ -95,6 +95,9 @@ api::DeviceInfo::DeviceType DeviceInfo::GetDeviceType() const {
std::optional<FilePath> DeviceInfo::GetDownloadPath() const {
char *dir = getenv("XDG_DOWNLOAD_DIR");
if (dir == nullptr) {
return FilePath("/tmp");
}
return FilePath(std::string(dir));
}
@@ -129,14 +129,14 @@ class DeviceInfo final : public api::DeviceInfo {
return api::DeviceInfo::OsType::kWindows; // Or ChromeOS?
}
std::optional<FilePath> GetDownloadPath() const override;
std::optional<FilePath> GetLocalAppDataPath() const override;
std::optional<FilePath> GetCommonAppDataPath() const override {
std::optional<nearby::FilePath> GetDownloadPath() const override;
std::optional<nearby::FilePath> GetLocalAppDataPath() const override;
std::optional<nearby::FilePath> GetCommonAppDataPath() const override {
return std::nullopt;
};
std::optional<FilePath> GetTemporaryPath() const override;
std::optional<FilePath> GetLogPath() const override;
std::optional<FilePath> GetCrashDumpPath() const override;
std::optional<nearby::FilePath> GetTemporaryPath() const override;
std::optional<nearby::FilePath> GetLogPath() const override;
std::optional<nearby::FilePath> GetCrashDumpPath() const override;
bool IsScreenLocked() const override;
void RegisterScreenLockedListener(