mirror of
https://github.com/Kopano-dev/kopano-ol-extension.git
synced 2023-10-10 13:37:40 +02:00
Added extra null checks to event registration, caused an exception when clicking around during full resync
This commit is contained in:
parent
86b2144e22
commit
b5ee982bc7
@ -61,9 +61,9 @@ namespace Acacia.ZPush
|
|||||||
protected override void DoRelease()
|
protected override void DoRelease()
|
||||||
{
|
{
|
||||||
Cleanup();
|
Cleanup();
|
||||||
_folder.Dispose();
|
_folder?.Dispose();
|
||||||
_items.Dispose();
|
_items?.Dispose();
|
||||||
_subFolders.Dispose();
|
_subFolders?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
@ -113,26 +113,38 @@ namespace Acacia.ZPush
|
|||||||
if (register)
|
if (register)
|
||||||
{
|
{
|
||||||
// Item events
|
// Item events
|
||||||
|
if (_items != null)
|
||||||
|
{
|
||||||
_items.ItemAdd += Items_ItemAdd;
|
_items.ItemAdd += Items_ItemAdd;
|
||||||
_items.ItemChange += Items_ItemChange;
|
_items.ItemChange += Items_ItemChange;
|
||||||
|
}
|
||||||
|
|
||||||
// Folder events
|
// Folder events
|
||||||
|
if (_subFolders != null)
|
||||||
|
{
|
||||||
_subFolders.FolderAdd += SubFolders_FolderAdd;
|
_subFolders.FolderAdd += SubFolders_FolderAdd;
|
||||||
_subFolders.FolderRemove += SubFolders_FolderRemove;
|
_subFolders.FolderRemove += SubFolders_FolderRemove;
|
||||||
_subFolders.FolderChange += SubFolders_FolderChange;
|
_subFolders.FolderChange += SubFolders_FolderChange;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Item events
|
// Item events
|
||||||
|
if (_items != null)
|
||||||
|
{
|
||||||
_items.ItemAdd -= Items_ItemAdd;
|
_items.ItemAdd -= Items_ItemAdd;
|
||||||
_items.ItemChange -= Items_ItemChange;
|
_items.ItemChange -= Items_ItemChange;
|
||||||
|
}
|
||||||
|
|
||||||
// Folder events
|
// Folder events
|
||||||
|
if (_subFolders != null)
|
||||||
|
{
|
||||||
_subFolders.FolderAdd -= SubFolders_FolderAdd;
|
_subFolders.FolderAdd -= SubFolders_FolderAdd;
|
||||||
_subFolders.FolderRemove -= SubFolders_FolderRemove;
|
_subFolders.FolderRemove -= SubFolders_FolderRemove;
|
||||||
_subFolders.FolderChange -= SubFolders_FolderChange;
|
_subFolders.FolderChange -= SubFolders_FolderChange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region Event handlers
|
#region Event handlers
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user