Skip to content

Commit

Permalink
fix: prevent infinity loop on fixing unfixable problems
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Sep 3, 2019
1 parent e1ffb9d commit f4808ea
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/store/modules/launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ const mod = {
if (user.accessToken === '' || gameProfile.name === '' || gameProfile.id === '') return Promise.reject(new Error('launch.auth.illegal'));

commit('launchStatus', 'checkingProblems');
for (let problems = rootState.profile.problems.filter(p => p.autofix);
problems.length !== 0;
problems = rootState.profile.problems.filter(p => p.autofix)) {
await dispatch('fixProfile', problems);

for (let problems = rootState.profile.problems.filter(p => p.autofix), i = 0;
problems.length !== 0 && i < 3;
problems = rootState.profile.problems.filter(p => p.autofix), i += 1) {
await dispatch('fixProfile', rootState.profile.problems.filter(p => p.autofix));
}

if (rootState.profile.problems.some(p => !p.optional)) {
Expand Down Expand Up @@ -80,7 +81,7 @@ const mod = {
selectedProfile: gameProfile,
accessToken: user.accessToken,
userType: UserType.Mojang,
properties: user.properties,
properties: {},
},
gamePath: minecraftFolder.root,
resourcePath: rootState.root,
Expand Down

0 comments on commit f4808ea

Please sign in to comment.