Fix crash when parent project does not have loom

dev/0.11
modmuss50 2019-04-15 09:12:48 +01:00
parent 8dc84f1449
commit e49af8ac39
1 changed files with 6 additions and 1 deletions

View File

@ -31,6 +31,7 @@ import net.fabricmc.loom.providers.MinecraftProvider;
import net.fabricmc.loom.util.LoomDependencyManager;
import org.cadixdev.lorenz.MappingSet;
import org.gradle.api.Project;
import org.gradle.api.UnknownDomainObjectException;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.ConfigurationContainer;
import org.gradle.api.artifacts.Dependency;
@ -158,7 +159,11 @@ public class LoomGradleExtension {
});
if(dependency == null && !AbstractPlugin.isRootProject(project)){
return project.getRootProject().getExtensions().getByType(LoomGradleExtension.class).getLoomVersion();
try {
return project.getRootProject().getExtensions().getByType(LoomGradleExtension.class).getLoomVersion();
} catch (UnknownDomainObjectException e){
return null;
}
}
return dependency != null ? dependency.getVersion() : null;