From 893925f599e4ff504abe1ccef5590b28378192b2 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Mon, 5 Jul 2021 18:38:24 +0200 Subject: [PATCH] Fix weird bug where a collection name of certain length fucks up the combo. --- Penumbra/Mods/CollectionManager.cs | 2 +- Penumbra/UI/MenuTabs/TabCollections.cs | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Penumbra/Mods/CollectionManager.cs b/Penumbra/Mods/CollectionManager.cs index 629ef8ba..1ad36af6 100644 --- a/Penumbra/Mods/CollectionManager.cs +++ b/Penumbra/Mods/CollectionManager.cs @@ -85,7 +85,7 @@ namespace Penumbra.Mods public bool AddCollection( string name, Dictionary< string, ModSettings > settings ) { var nameFixed = name.RemoveInvalidPathSymbols().ToLowerInvariant(); - if( Collections.Values.Any( c => c.Name.RemoveInvalidPathSymbols().ToLowerInvariant() == nameFixed ) ) + if( nameFixed == string.Empty || Collections.Values.Any( c => c.Name.RemoveInvalidPathSymbols().ToLowerInvariant() == nameFixed ) ) { PluginLog.Warning( $"The new collection {name} would lead to the same path as one that already exists." ); return false; diff --git a/Penumbra/UI/MenuTabs/TabCollections.cs b/Penumbra/UI/MenuTabs/TabCollections.cs index a5b9436c..6039cede 100644 --- a/Penumbra/UI/MenuTabs/TabCollections.cs +++ b/Penumbra/UI/MenuTabs/TabCollections.cs @@ -1,11 +1,9 @@ -using System; using System.Collections.Generic; using System.Linq; using System.Numerics; using Dalamud.Interface; using Dalamud.Plugin; using ImGuiNET; -using Penumbra.Interop; using Penumbra.Mod; using Penumbra.Mods; using Penumbra.Util; @@ -31,7 +29,7 @@ namespace Penumbra.UI private void UpdateNames() { _collections = _manager.Collections.Collections.Values.Prepend( ModCollection.Empty ).ToArray(); - _collectionNames = string.Join( "\0", _collections.Skip( 1 ).Select( c => c.Name ) ); + _collectionNames = string.Join( "\0", _collections.Skip( 1 ).Select( c => c.Name ) ) + '\0'; _collectionNamesWithNone = "None\0" + _collectionNames; UpdateIndices(); }