Calindra / nonodo

Development Node for Cartesi Rolups
Apache License 2.0
14 stars 14 forks source link

Container checking wrong object before returning #84

Closed DiegoSena closed 1 month ago

DiegoSena commented 1 month ago

In the function below, the first if statement is checking ig syncRepo is different than nil and returning noticeRepo. The correct would be checking if noticeRepo != nil

func (c *Container) GetNoticeRepository() *repository.NoticeRepository {
    if c.syncRepository != nil {
        return c.noticeRepository
    }
    c.noticeRepository = &repository.NoticeRepository{
        Db: *c.db,
    }
    err := c.noticeRepository.CreateTables()
    if err != nil {
        panic(err)
    }
}