Fix weird bug where a collection name of certain length fucks up the combo.

This commit is contained in:
Ottermandias 2021-07-05 18:38:24 +02:00
parent 071da49ba9
commit 893925f599
2 changed files with 2 additions and 4 deletions

View file

@ -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;

View file

@ -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();
}