@@ -230,7 +230,10 @@ protected override void GetItem(string path)
230230 {
231231 string Id = dic [ IdParam ] . Value . ToString ( ) ;
232232 Item itemById = Factory . GetDatabase ( PSDriveInfo . Name ) . GetItem ( new ID ( Id ) ) ;
233- WriteMatchingItem ( language , version , itemById ) ;
233+ if ( itemById != null )
234+ {
235+ WriteMatchingItem ( language , version , itemById ) ;
236+ }
234237 return ;
235238 }
236239
@@ -333,7 +336,7 @@ protected override void CopyItem(string path, string destination, bool recurse)
333336 }
334337 }
335338
336- if ( ShouldProcess ( sourceItem . Paths . Path , "Copy to '" + destinationItem . Paths . Path + "/" + leafName + "'" ) )
339+ if ( ShouldProcess ( sourceItem . Paths . Path , "Copy to '" + destinationItem . Paths . Path + "/" + leafName + "'" ) )
337340 {
338341 var id = new ID ( Guid . NewGuid ( ) ) ;
339342 Item itemCopy = sourceItem . CopyTo ( destinationItem , leafName , id , recurse ) ;
@@ -382,7 +385,7 @@ protected override void MoveItem(string path, string destination)
382385 }
383386 }
384387
385- if ( ShouldProcess ( sourceItem . Paths . Path , "Move to '" + destinationItem . Paths . Path + "/" + leafName ) )
388+ if ( ShouldProcess ( sourceItem . Paths . Path , "Move to '" + destinationItem . Paths . Path + "/" + leafName ) )
386389 {
387390 sourceItem . MoveTo ( destinationItem ) ;
388391
@@ -412,7 +415,7 @@ protected override void RenameItem(string path, string newName)
412415 if ( item != null )
413416 {
414417 CheckOperationAllowed ( "rename" , item . Access . CanRename ( ) , item . Uri . ToString ( ) ) ;
415- if ( ShouldProcess ( item . Paths . Path , "Rename to '" + newName + "'" ) )
418+ if ( ShouldProcess ( item . Paths . Path , "Rename to '" + newName + "'" ) )
416419 {
417420 item . Edit (
418421 args => { item . Name = newName ; } ) ;
@@ -449,7 +452,7 @@ protected override void NewItem(string path, string itemTypeName, object newItem
449452
450453 Item srcItem = GetItemForPath ( "/" + itemTypeName ) ;
451454
452- if ( srcItem == null )
455+ if ( srcItem == null )
453456 {
454457 throw new ObjectNotFoundException (
455458 string . Format ( "Template '{0}' does not exist or wrong path provided." ,
@@ -463,7 +466,8 @@ protected override void NewItem(string path, string itemTypeName, object newItem
463466 parentItem = dic [ ParentParam ] . Value as Item ;
464467 }
465468
466- if ( ShouldProcess ( GetParentFromPath ( path ) , "Create item '" + GetLeafFromPath ( path ) + "' of type '" + itemTypeName + "'" ) )
469+ if ( ShouldProcess ( GetParentFromPath ( path ) ,
470+ "Create item '" + GetLeafFromPath ( path ) + "' of type '" + itemTypeName + "'" ) )
467471 {
468472 Item createdItem = null ;
469473 if ( srcItem . TemplateName == "Template" )
0 commit comments