dumb nil panic

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-06 15:51:29 -06:00
parent e6f883a9b5
commit 31355467a5
2 changed files with 12 additions and 0 deletions

View File

@ -70,6 +70,14 @@ func (rs *RepoStatus) IsProtobuf() (bool, []string, error) {
// returns the filesystem path to the repo
func (rs *RepoStatus) Path() string {
if rs == nil {
log.Warn("rs == nil")
return ""
}
if rs.realPath == nil {
log.Warn("rs.realPath == nil")
return ""
}
return rs.realPath.String()
}

View File

@ -221,6 +221,10 @@ func IsDirectory(path string) bool {
}
func (rs *RepoStatus) Exists(filename string) bool {
if rs == nil {
log.Warn("rs == nil for Exists()")
panic(-1)
}
testf := filepath.Join(rs.Path(), filename)
if Exists(testf) {
return true