i have a application which shows images from the system.

when i plug any pen dirve with images contained , those images too will be shown in the application.

say for example if i have 500 images means it takes some time to show it.

suddenly if we unplug the pen drive from the system means,my application gets crashed...

Any ideas to avoid that crash....

Thanks for any help