Guest User

Untitled

a guest
May 24th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. Index: lib/MT/Component.pm
  2. ===================================================================
  3. --- lib/MT/Component.pm (revision 3104)
  4. +++ lib/MT/Component.pm (working copy)
  5. @@ -152,8 +152,19 @@
  6. $path = File::Spec->catfile( $c->path, $file );
  7. return unless -f $path;
  8. require YAML::Tiny;
  9. - my $y = eval { YAML::Tiny->read($path) }
  10. - or die "Error reading $path: " . (YAML::Tiny->errstr||$@||$!);
  11. + my $y = eval { YAML::Tiny->read($path) };
  12. + if (!$y) {
  13. + if ($c->isa('MT::Plugin')) {
  14. + my $msg = sprintf "PLUGIN Error reading %s: %s", $path, (YAML::Tiny->errstr||$@||$!);
  15. + print STDERR $msg."\n";
  16. + $c->error($msg);
  17. + return 0;
  18. + }
  19. + else {
  20. + die "Error reading $path: " . (YAML::Tiny->errstr||$@||$!);
  21. + }
  22. + }
  23. +
  24. if ( ref($y) ) {
  25.  
  26. # skip over non-hash elements
Add Comment
Please, Sign In to add comment