Fixed crash related to uninitialized content

This commit is contained in:
Anuken 2024-08-08 19:57:29 -04:00
parent 8cd8b2c6df
commit 9063fca2b5
2 changed files with 8 additions and 1 deletions

View File

@ -171,6 +171,13 @@ public class ContentLoader{
public void handleMappableContent(MappableContent content){
if(contentNameMap[content.getContentType().ordinal()].containsKey(content.name)){
var list = contentMap[content.getContentType().ordinal()];
//this method is only called when registering content, and after handleContent.
//If this is the last registered content, and it is invalid, make sure to remove it from the list to prevent invalid stuff from being registered
if(list.size > 0 && list.peek() == content){
list.pop();
}
throw new IllegalArgumentException("Two content objects cannot have the same name! (issue: '" + content.name + "')");
}
if(currentMod != null){

View File

@ -64,7 +64,7 @@ public abstract class UnlockableContent extends MappableContent{
@Override
public void loadIcon(){
fullIcon =
Core.atlas.find(fullOverride,
Core.atlas.find(fullOverride == null ? "" : fullOverride,
Core.atlas.find(getContentType().name() + "-" + name + "-full",
Core.atlas.find(name + "-full",
Core.atlas.find(name,