#1150 Exception thrown on unlock of multiple databases with additional factors

KeePass_2.x
closed
nobody
None
5
2013-11-30
2013-08-07
wellread1
No

When multiple databases are locked in a Workspace, the option "Show expired entries (if any)" is checked, and a trigger that activates a database in the workspace other than the one that is to be unlocked exists, then KeePass throws the exception shown below.

To demonstrate the bug

Setup
1. Windows Home Premium x64
2. KeePass 2.23 (ZIP install)
    a. Two newly created databases; A.kdbx & B.kdbx with no edits
    b. Non-default setting "Show expired entries (if any)" checked
    c. Trigger to activate B.kdbx on opening A.kdbx (shown below)

Procedure
1. Open A.kdbx & B.kdbx in Workspace
2. Lock Workspace
3. Select A.kdbx in Workspace and unlock
    a. A.kdbx will unlock
    b. Locked database B.kdbx will be selected
    c. Exception is thrown

Trigger

<?xml version="1.0" encoding="utf-8"?>
<TriggerCollection xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Triggers>
        <Trigger>
            <Guid>HrSVDnkGLUifCNl9DKQQMw==</Guid>
            <Name>On db open/unlock:  Activate B.kdbx</Name>
            <Events>
                <Event>
                    <TypeGuid>5f8TBoW4QYm5BvaeKztApw==</TypeGuid>
                    <Parameters>
                        <Parameter>1</Parameter>
                        <Parameter>A.kdbx</Parameter>
                    </Parameters>
                </Event>
            </Events>
            <Conditions />
            <Actions>
                <Action>
                    <TypeGuid>P7gzLdYWToeZBWTbFkzWJg==</TypeGuid>
                    <Parameters>
                        <Parameter>B.kdbx</Parameter>
                    </Parameters>
                </Action>
            </Actions>
        </Trigger>
    </Triggers>
</TriggerCollection>

Exception

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at KeePass.Forms.MainForm.ShowExpiredEntries(Boolean bOnlyIfExists, Boolean bShowExpired, Boolean bShowSoonToExpire)
   at KeePass.Forms.MainForm.OpenDatabase(IOConnectionInfo ioConnection, CompositeKey cmpKey, Boolean bOpenLocal)
   at KeePass.Forms.MainForm.OnFileLock(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18052 built by: FX45RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
KeePass
    Assembly Version: 2.23.0.16981
    Win32 Version: 2.23.0.0
    CodeBase: file:///C:/Programs/KeePass%20Password%20Safe%202.23%20Testbed%20bad/KeePass.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18047 built by: FX45RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18021 built by: FX45RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18044 built by: FX45RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18054 built by: FX45RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18054 built by: FX45RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Security
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18047 built by: FX45RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Security/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Discussion

  • Dominik Reichl
    Dominik Reichl
    2013-08-19

    Excellent bug report, thanks :-) I was able to reproduce the issue and have fixed it.

    Here's the latest development snapshot for testing:
    http://keepass.info/filepool/KeePass_130819.zip

    Best regards,
    Dominik

     
  • Dominik Reichl
    Dominik Reichl
    2013-08-19

    • status: open --> closed