remove pointer from profiles

This commit is contained in:
Celogeek 2024-05-11 14:25:20 +02:00
parent e10eeadc4e
commit b1e246240c
Signed by: celogeek
SSH Key Fingerprint: SHA256:njNJLzoLQdbV9PC6ehcruRb0QnEgxABoCYZ+0+aUIYc
2 changed files with 6 additions and 3 deletions

View File

@ -330,7 +330,10 @@ func (o *Options) SaveConfig() error {
// GetProfile shortcut to get current profile
func (o *Options) GetProfile() *profiles.Profile {
return o.profiles[o.Profile]
if p, ok := o.profiles[o.Profile]; ok {
return &p
}
return nil
}
// AvailableProfiles all available profiles

View File

@ -13,7 +13,7 @@ type Profile struct {
Height int `json:"height"`
}
type Profiles map[string]*Profile
type Profiles map[string]Profile
// New Initialize list of all supported profiles.
func New() Profiles {
@ -52,7 +52,7 @@ func New() Profiles {
{"RM1", "reMarkable 1", 1404, 1872},
{"RM2", "reMarkable 2", 1404, 1872},
} {
res[r.Code] = &r
res[r.Code] = r
}
return res
}