add nil pointer check

This commit is contained in:
Fuad Hasan 2025-02-03 03:22:43 +06:00 committed by GitHub
parent 296b70a062
commit 6c8d979668
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,7 +24,7 @@ var STDOUT_FORMAT_MAP = map[string]exportExtension{
var SUPPORTED_STDOUT_FORMATS = []string{"png", "svg"}
func getOutputFormat(stdoutFormatFlag *string, outputPath string) (exportExtension, error) {
if *stdoutFormatFlag != "" {
if stdoutFormatFlag != nil && *stdoutFormatFlag != "" {
format := strings.ToLower(*stdoutFormatFlag)
if ext, ok := STDOUT_FORMAT_MAP[format]; ok {
return ext, nil