Index: Storage.pm =================================================================== --- Storage.pm (revision 29714) +++ Storage.pm (working copy) @@ -68,6 +68,34 @@ unlink($lockFile); } + } elsif ($@ && $@ =~ /SQLite.*database disk image is malformed/i) { + + my $dbfile = File::Spec->catfile( preferences('server')->get('librarycachedir'), 'squeezebox.db' ); + + unlink($dbfile); + + if (!-f $dbfile) { + + logWarning("$@\nTrying to start from scratch."); + + $@ = ''; + + if ( $sqlHelperClass && $sqlHelperClass->init( $self->_dbh ) ) { + + eval { $self->ensure_connected }; + + if ($@) { + logError("Unable to open the database image - even tried creating it from scratch!"); + logError("Fatal. Exiting."); + exit; + } + } + + } + else { + return $self->throw_exception($@); + } + } elsif ($@) { return $self->throw_exception($@);