fix(backend): nil-guard

This commit is contained in:
ShiKhu 2021-12-14 21:05:35 +01:00
parent b780ecc530
commit d206d96b8a

View file

@ -1,5 +1,7 @@
package types
import "log"
type Project struct {
ProjectID uint32
ProjectKey string
@ -19,6 +21,10 @@ type Project struct {
func (p *Project) GetMetadataNo(key string) uint {
if p == nil {
log.Printf("GetMetadataNo: Project is nil")
return 0
}
if p.Metadata1 != nil && *(p.Metadata1) == key {
return 1
}