From 31355467a58e87673f959dbfed933ad02fba0733 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 6 Nov 2024 15:51:29 -0600 Subject: [PATCH] dumb nil panic Signed-off-by: Jeff Carr --- common.go | 8 ++++++++ unix.go | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/common.go b/common.go index 8895542..8b88913 100644 --- a/common.go +++ b/common.go @@ -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() } diff --git a/unix.go b/unix.go index 6d90676..d4d48de 100644 --- a/unix.go +++ b/unix.go @@ -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