@@ -925,11 +925,22 @@ export async function downloadDefaultWine() {
925
925
// get list of wines on wineDownloaderInfoStore
926
926
const availableWine = wineDownloaderInfoStore . get ( 'wine-releases' , [ ] )
927
927
// use Wine-GE type if on Linux and Wine-Crossover if on Mac
928
- const release = availableWine . filter (
929
- ( version ) =>
930
- version . type === ( isLinux ? 'Wine-GE' : 'Wine-Crossover' ) &&
931
- version . version . includes ( 'Wine-GE-Proton' )
932
- ) [ 0 ]
928
+ const release = availableWine . filter ( ( version ) => {
929
+ if ( isLinux ) {
930
+ return (
931
+ version . type === 'Wine-GE' && version . version . includes ( 'Wine-GE-Proton' )
932
+ )
933
+ } else if ( isMac ) {
934
+ return version . type === 'Wine-Crossover'
935
+ }
936
+ return false
937
+ } ) [ 0 ]
938
+
939
+ if ( ! release ) {
940
+ logError ( 'Could not find default wine version' , LogPrefix . Backend )
941
+ return null
942
+ }
943
+
933
944
// download the latest version
934
945
const onProgress = ( state : State , progress ?: ProgressInfo ) => {
935
946
sendFrontendMessage ( 'progressOfWineManager' + release . version , {
@@ -944,11 +955,19 @@ export async function downloadDefaultWine() {
944
955
)
945
956
deleteAbortController ( release . version )
946
957
if ( result === 'success' ) {
947
- const wineList = await GlobalConfig . get ( ) . getAlternativeWine ( )
948
- // update the game config to use that wine
949
- const downloadedWine = wineList [ 0 ]
950
- logInfo ( `Changing wine version to ${ downloadedWine . name } ` )
951
- GlobalConfig . get ( ) . setSetting ( 'wineVersion' , downloadedWine )
958
+ let downloadedWine = null
959
+ try {
960
+ const wineList = await GlobalConfig . get ( ) . getAlternativeWine ( )
961
+ // update the game config to use that wine
962
+ downloadedWine = wineList [ 0 ]
963
+ logInfo ( `Changing wine version to ${ downloadedWine . name } ` )
964
+ GlobalConfig . get ( ) . setSetting ( 'wineVersion' , downloadedWine )
965
+ } catch ( error ) {
966
+ logError (
967
+ [ 'Error when changing wine version to default' , error ] ,
968
+ LogPrefix . Backend
969
+ )
970
+ }
952
971
return downloadedWine
953
972
}
954
973
return null
0 commit comments