Fix nilpointer in js.Build error handling

Fixes #8162
This commit is contained in:
Bjørn Erik Pedersen 2021-01-21 10:09:33 +01:00
parent a1a9f088b1
commit a1fe552fc9
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -14,7 +14,6 @@
package js
import (
"errors"
"fmt"
"io/ioutil"
"os"
@ -22,6 +21,8 @@ import (
"regexp"
"strings"
"github.com/pkg/errors"
"github.com/spf13/afero"
"github.com/gohugoio/hugo/hugofs"
@ -108,6 +109,9 @@ func (t *buildTransformation) Transform(ctx *resources.ResourceTransformationCtx
createErr := func(msg api.Message) error {
loc := msg.Location
if loc == nil {
return errors.New(msg.Text)
}
path := loc.File
var (