fix(backend): nil-guard
This commit is contained in:
parent
b780ecc530
commit
d206d96b8a
1 changed files with 6 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue