AdamsLair / duality

a 2D Game Development Framework
https://adamslair.github.io/duality
MIT License
1.4k stars 289 forks source link

Prevent null exception in "Select Type"-Form #749

Closed ChristianGreiner closed 4 years ago

ChristianGreiner commented 4 years ago

Summary

"Select Type" Form throws Null Exception when no input is given

How to reproduce

Analysis

Attachments

EditorError:   ArgumentNullException: Value cannot be null.
Parameter name: key
CallStack:
   at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at Duality.GameObject.GetComponent(Type t) in C:\projects\duality\Source\Core\Duality\GameObject.cs:line 547
   at Duality.Editor.Plugins.Base.PropertyEditors.AddComponentPropertyEditor.OnAddComponentClicked() in C:\projects\duality\Source\Plugins\EditorBase\PropertyEditors\AddComponentPropertyEditor.cs:line 147
   at Duality.Editor.Plugins.Base.PropertyEditors.AddComponentPropertyEditor.OnMouseUp(MouseEventArgs e) in C:\projects\duality\Source\Plugins\EditorBase\PropertyEditors\AddComponentPropertyEditor.cs:line 110
   at AdamsLair.WinForms.PropertyEditing.GroupedPropertyEditor.OnMouseUp(MouseEventArgs e) in D:\svn\Projects\AdamsLair.WinForms\WinForms\PropertyEditing\GroupedPropertyEditor.cs:line 792
   at AdamsLair.WinForms.PropertyEditing.PropertyGrid.OnMouseUp(MouseEventArgs e) in D:\svn\Projects\AdamsLair.WinForms\WinForms\PropertyEditing\PropertyGrid.cs:line 757
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.UserControl.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
ilexp commented 4 years ago

Thanks for reporting! Since this doesn't seem time critical, I'm flagging this as a good issue for first time contributors for now.

ilexp commented 4 years ago

Fixed by @foreverWIP. Closing this.