Miaoyww / NonsPlayer

Multiple music streaming services & High performance.A real music player. 多音源 | 高性能。一个真正的音乐播放器
GNU General Public License v3.0
172 stars 6 forks source link

[BUG]本地音乐无法浏览 #59

Closed molingyu closed 2 months ago

molingyu commented 2 months ago

Describe the bug 打开 本地 -> 本地音乐 直接闪退 错误日志如下

[14:58:02.381] [EROR] []: Unhandled exception threw: SixLabors.ImageSharp.UnknownImageFormatException: Image cannot be loaded. Available decoders:
 - QOI : QoiDecoder
 - Webp : WebpDecoder
 - TGA : TgaDecoder
 - PNG : PngDecoder
 - GIF : GifDecoder
 - PBM : PbmDecoder
 - TIFF : TiffDecoder
 - BMP : BmpDecoder
 - JPEG : JpegDecoder

   at SixLabors.ImageSharp.Formats.ImageFormatManager.ThrowInvalidDecoder(ImageFormatManager manager)
   at SixLabors.ImageSharp.Image.InternalDetectFormat(Configuration configuration, Stream stream)
   at SixLabors.ImageSharp.Image.DiscoverDecoder(DecoderOptions options, Stream stream)
   at SixLabors.ImageSharp.Image.<>c__DisplayClass80_0.<Load>b__0(Stream s)
   at NonsPlayer.Core.Utils.LocalUtils.CompressAndConvertToByteArray(Byte[] imageData, Int32 width, Int32 height) in D:\a\NonsPlayer\NonsPlayer\NonsPlayer.Core\Utils\LocalUtils.cs:line 30
   at NonsPlayer.Core.Models.LocalMusic.Init() in D:\a\NonsPlayer\NonsPlayer\NonsPlayer.Core\Models\LocalMusic.cs:line 61
   at NonsPlayer.ViewModels.LocalMusicLibViewModel.Refresh() in D:\a\NonsPlayer\NonsPlayer\NonsPlayer\ViewModels\Local\LocalMusicLibViewModel.cs:line 38
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext.<>c__DisplayClass2_0.<Post>b__0()
[14:58:04.001] [EROR] []: Unhandled exception threw: System.NullReferenceException: Object reference not set to an instance of an object.
   at NonsPlayer.Components.ViewModels.MusicListItemViewModel.Init(IMusic music) in D:\a\NonsPlayer\NonsPlayer\NonsPlayer\Components\ViewModels\MusicListItemViewModel.cs:line 66
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext.<>c__DisplayClass2_0.<Post>b__0()

To Reproduce

Expected behavior

Screenshots null

Desktop (please complete the following information):

molingyu commented 2 months ago

发现问题了 是我的音乐文件的 cover 数据有问题 CompressAndConvertToByteArray 直接 crash 然后后续的 LocalMusic.Init 都没有执行结果一路错下去了

不过建议CompressAndConvertToByteArray的 catch 可以范围更大一些 有问题写个warn log 避免直接导致整个程序crash