develar / app-builder

Generic helper tool to build app in a distributable format
MIT License
120 stars 61 forks source link

Crash while building linux after changing icon.icns #68

Open amazingmarvin opened 3 years ago

amazingmarvin commented 3 years ago

I found what may be the same crash reported in electron-userland/electron-builder#5844

I recently changed my app's macos icon (the build works and the icon displays correctly), and now when I build for linux, the build crashes here:

https://github.com/develar/app-builder/blob/b44c18756a8e8cc8cddebde0fb6e5fce2ec6bcb7/pkg/icons/icns-to-png.go#L60

The error message is panic: runtime error: index out of range [-1], meaning this result slice is empty.

Here's the old icon: https://s3.amazonaws.com/community.amazingmarvin.com/old_icon.icns and the new icon: https://s3.amazonaws.com/community.amazingmarvin.com/new_icon.icns

Interestingly the old icon shows correctly in Finder whereas the new icon shows a generic image icon, so possibly the file format is invalid somehow (though using an online icns->png converter works):

image
amazingmarvin commented 3 years ago

I rebuilt the icon using iconutil and it both looks correct in Finder and fixes the build. I will leave this open since I think it might be worth panicking with a better error when len(result) == 0, but feel free to close at your convenience!