@@ -473,21 +473,22 @@ static bool logoPrintData(bool doColorReplacement, FFstrbuf* source)
473473 return true;
474474}
475475
476- static void updateLogoPath (void )
476+ static bool updateLogoPath (void )
477477{
478478 FFOptionsLogo * options = & instance .config .logo ;
479479
480480 if (ffPathExists (options -> source .chars , FF_PATHTYPE_FILE ))
481- return ;
481+ return true ;
482482
483483 if (ffStrbufEqualS (& options -> source , "-" )) // stdin
484- return ;
484+ return true ;
485485
486486 FF_STRBUF_AUTO_DESTROY fullPath = ffStrbufCreate ();
487487 if (ffPathExpandEnv (options -> source .chars , & fullPath ) && ffPathExists (fullPath .chars , FF_PATHTYPE_FILE ))
488488 {
489- ffStrbufSet (& options -> source , & fullPath );
490- return ;
489+ ffStrbufDestroy (& options -> source );
490+ ffStrbufInitMove (& options -> source , & fullPath );
491+ return true;
491492 }
492493
493494 FF_LIST_FOR_EACH (FFstrbuf , dataDir , instance .state .platform .dataDirs )
@@ -499,10 +500,13 @@ static void updateLogoPath(void)
499500
500501 if (ffPathExists (fullPath .chars , FF_PATHTYPE_FILE ))
501502 {
502- ffStrbufSet (& options -> source , & fullPath );
503- break ;
503+ ffStrbufDestroy (& options -> source );
504+ ffStrbufInitMove (& options -> source , & fullPath );
505+ return true;
504506 }
505507 }
508+
509+ return false;
506510}
507511
508512static bool logoPrintFileIfExists (bool doColorReplacement , bool raw )
@@ -586,7 +590,13 @@ static bool logoTryKnownType(void)
586590 return logoPrintData (false, & source );
587591 }
588592
589- updateLogoPath (); //We sure have a file, resolve relative paths
593+ //We sure have a file, resolve relative paths
594+ if (!updateLogoPath ())
595+ {
596+ if (instance .config .display .showErrors )
597+ fprintf (stderr , "Logo: Failed to resolve logo source: %s\n" , options -> source .chars );
598+ return false;
599+ }
590600
591601 if (options -> type == FF_LOGO_TYPE_FILE )
592602 return logoPrintFileIfExists (true, false);
@@ -649,7 +659,12 @@ void ffLogoPrint(void)
649659 return ;
650660
651661 //Make sure the logo path is set correctly.
652- updateLogoPath ();
662+ if (!updateLogoPath ())
663+ {
664+ if (instance .config .display .showErrors )
665+ fprintf (stderr , "Logo: Failed to resolve logo source: %s\n" , options -> source .chars );
666+ return ;
667+ }
653668
654669 if (ffStrbufEndsWithIgnCaseS (& options -> source , ".raw" ))
655670 {
0 commit comments