To help you locate the problem you can idetify where in the code this is happening by catching all unhandled exceptions and logging them in a manor that is fit for your application.
Now each application type has different methods for catching unhandled exceptions. Here are some basic pointers for different types.
WinForms: http://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception.aspx
WPF : http://msdn.microsoft.com/en-us/library/system.windows.application.dispatcherunhandledexception.aspx
WebForms \ MVC : http://msdn.microsoft.com/en-us/library/24395wz3(v=vs.100).aspx
Now how you log is your own responsibility you can use some off the shelf \ OS features if you wish.
log4net: http://logging.apache.org/log4net/
EventLogs: http://support.microsoft.com/kb/307024
Back to original problem. The reason you are getting the error is you are accessing \ manipulating an object that is not set. Now which object and why is quite difficult to trace and impossible for us to resolve without some indication as to where this error is ocurring. At a minimum we would need to know where in the code this is happening.
Ideally a full stack trace will resolve this quite quickly.
Cheers.