mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
added null guards to device info
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user