Exported from Bugzilla, issue 3516.
--- Comment added on 7/19/02 11:47:10 AM ---
Customer Report:
(This report applies to SysTools 3.03 and Shellshock 1.01 as well)
To reproduce:
In a TStShellTreeView component, set the RootFolder
property to e.g. "C:\", then back to an empty string.
Add or delete a file in C:\ -> Exception.
Reason:
The ShellTreeView will still receive notifications
for its old root folder. When it does, it throws an exception
in FindNodeByPidl(), because it accesses Items[0] without
prior checking whether there are any items in the list.
Quick fix:
(must be done in TStCustomShellTreeView.FindNodeByPidl()
and TStCustomShellTreeView.FindNodeByPath() resp.):
Replace the line
Node := Items[0];
with
if (Items.Count > 0) then
Node := Items[0]
else
Node := Nil;
Better fix (to be applied in addition):
Request to Turbopower support: Please deactivate notifications
when the RootFolder property is cleared. One wouldn't expect
getting notifications for "C:\" just because it once _was_ the
RootFolder set. As the ShellMonitor object is protected, there
is currently no way to avoid this error without changing your
source codes (which makes maintenance difficult).
Logged In: YES
user_id=809814
But where is the solution to "invalid index" problem???