Made sure that empty surfaces are not attempted to be destroyed in
Kartik Thakore [Sat, 8 Aug 2009 17:44:06 +0000 (13:44 -0400)]
TTFont::DESTROY().

lib/SDL/TTFont.pm

index 5aab81e..d9b6e60 100644 (file)
@@ -69,8 +69,8 @@ sub new {
 
 sub DESTROY {
        my $self = shift;
-       SDL::FreeSurface($self->{-surface});
-       SDL::TTFCloseFont($self->{-font});
+       SDL::FreeSurface($self->{-surface}) if (defined ($self->{-surface}));
+       SDL::TTFCloseFont($self->{-font}) if (defined ($self->{-font}));
 }
 
 sub print {