@@ -473,21 +473,22 @@ static bool logoPrintData(bool doColorReplacement, FFstrbuf* source)
473
473
return true;
474
474
}
475
475
476
- static void updateLogoPath (void )
476
+ static bool updateLogoPath (void )
477
477
{
478
478
FFOptionsLogo * options = & instance .config .logo ;
479
479
480
480
if (ffPathExists (options -> source .chars , FF_PATHTYPE_FILE ))
481
- return ;
481
+ return true ;
482
482
483
483
if (ffStrbufEqualS (& options -> source , "-" )) // stdin
484
- return ;
484
+ return true ;
485
485
486
486
FF_STRBUF_AUTO_DESTROY fullPath = ffStrbufCreate ();
487
487
if (ffPathExpandEnv (options -> source .chars , & fullPath ) && ffPathExists (fullPath .chars , FF_PATHTYPE_FILE ))
488
488
{
489
- ffStrbufSet (& options -> source , & fullPath );
490
- return ;
489
+ ffStrbufDestroy (& options -> source );
490
+ ffStrbufInitMove (& options -> source , & fullPath );
491
+ return true;
491
492
}
492
493
493
494
FF_LIST_FOR_EACH (FFstrbuf , dataDir , instance .state .platform .dataDirs )
@@ -499,10 +500,13 @@ static void updateLogoPath(void)
499
500
500
501
if (ffPathExists (fullPath .chars , FF_PATHTYPE_FILE ))
501
502
{
502
- ffStrbufSet (& options -> source , & fullPath );
503
- break ;
503
+ ffStrbufDestroy (& options -> source );
504
+ ffStrbufInitMove (& options -> source , & fullPath );
505
+ return true;
504
506
}
505
507
}
508
+
509
+ return false;
506
510
}
507
511
508
512
static bool logoPrintFileIfExists (bool doColorReplacement , bool raw )
@@ -586,7 +590,13 @@ static bool logoTryKnownType(void)
586
590
return logoPrintData (false, & source );
587
591
}
588
592
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
+ }
590
600
591
601
if (options -> type == FF_LOGO_TYPE_FILE )
592
602
return logoPrintFileIfExists (true, false);
@@ -649,7 +659,12 @@ void ffLogoPrint(void)
649
659
return ;
650
660
651
661
//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
+ }
653
668
654
669
if (ffStrbufEndsWithIgnCaseS (& options -> source , ".raw" ))
655
670
{
0 commit comments