@@ -347,24 +347,23 @@ public static void InsertNode(Dictionary<string, object> nestedDictionary, strin
347347 // Inserts new subdictionaries if one doesn't already exist
348348 if ( ! current . ContainsKey ( part ) )
349349 {
350- var innerObject = new Dictionary < string , object > ( ) ;
351- current [ part ] = innerObject ;
352- current = innerObject ;
350+ var innerDictionary = new Dictionary < string , object > ( ) ;
351+ current [ part ] = innerDictionary ;
352+ current = innerDictionary ;
353+ continue ;
353354 }
354- else // Traverses already existing subdictionaries
355+
356+ var innerObject = current [ part ] ;
357+
358+ // Handle instances where a protection was already assigned to the current node
359+ if ( innerObject is string [ ] existingProtections )
355360 {
356- var innerObject = current [ part ] ;
357-
358- // Handle instances where a protection was already assigned to the current node
359- if ( innerObject is string [ ] existingProtections )
360- {
361- modifyNodeList . Add ( ( current , part , existingProtections ) ) ;
362- innerObject = new Dictionary < string , object > ( ) ;
363- }
364-
365- current [ part ] = innerObject ;
366- current = ( Dictionary < string , object > ) current [ part ] ;
361+ modifyNodeList . Add ( ( current , part , existingProtections ) ) ;
362+ innerObject = new Dictionary < string , object > ( ) ;
367363 }
364+
365+ current [ part ] = innerObject ;
366+ current = ( Dictionary < string , object > ) current [ part ] ;
368367 }
369368 // If the "leaf" dictionary has been reached, add the file and its protections.
370369 current . Add ( pathParts [ ^ 1 ] , protections ) ;
0 commit comments