Prevent potential nil error on timestamps

This commit is contained in:
makeworld 2020-11-27 17:52:36 -05:00
parent f6e89fdaa1
commit 71be668652

View File

@ -61,12 +61,12 @@ func GetPageEntries() *PageEntries {
// Try to use updated time first, then published
if !item.UpdatedParsed.IsZero() {
if item.UpdatedParsed != nil && !item.UpdatedParsed.IsZero() {
pub = *item.UpdatedParsed
} else if !item.PublishedParsed.IsZero() {
} else if item.PublishedParsed != nil && !item.PublishedParsed.IsZero() {
pub = *item.PublishedParsed
} else {
// No time on the post
// No time on the post, use now
pub = time.Now()
}