BinaryConstruct/Terraria-Map-Editor — Issue #218: Crash if sprite selected before selecting "Sprite" tool
Author: jgdogg441
Created: 2012-01-15 06:49:13+00:00
State: open

If I click the sprite placement tool then select a sprite it works fine, but if I click a sprite first, THEN pick the sprite tool, the program crashes.

Please note that I have no idea how to apply fixes. So a quick rundown on how to apply a fix would be greatly appreciated.

this is the log contents

01-15-2012 01:00 v3.1.12009.2302 Error - Object reference not set to an instance of an object.
at System.Windows.Media.Imaging.WriteableBitmapEx.ToTexture2D(WriteableBitmap bmp, GraphicsDevice gd) in D:\Dev\_PROJECTS\BCCL\BCCL.Xna\WriteableBitmapEx\WriteableBitmapEx.cs:line 42
at TEditXna.View.WorldRenderXna.UpdatePreview() in D:\Dev\_PROJECTS\Terraria\Terraria-Map-Editor\TEditXna\View\WorldRenderXna.xaml.cs:line 115
at TEditXna.View.WorldRenderXna.PreviewChanged(Object sender, EventArgs e) in D:\Dev\_PROJECTS\Terraria\Terraria-Map-Editor\TEditXna\View\WorldRenderXna.xaml.cs:line 109
at TEditXna.ViewModel.WorldViewModel.OnPreviewChanged(Object sender, EventArgs e) in D:\Dev\_PROJECTS\Terraria\Terraria-Map-Editor\TEditXna\ViewModel\WorldViewModel.cs:line 306
at TEditXna.ViewModel.WorldViewModel.SetActiveTool(ITool tool) in D:\Dev\_PROJECTS\Terraria\Terraria-Map-Editor\TEditXna\ViewModel\WorldViewModel.cs:line 322
at BCCL.MvvmLight.Command.RelayCommand`1.Execute(Object parameter) in D:\Dev\_PROJECTS\BCCL\BCCL\MvvmLight\Command\RelayCommandGeneric.cs:line 114
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Primitives.ToggleButton.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at TEditXna.App.Main() in D:\Dev\_PROJECTS\Terraria\Terraria-Map-Editor\TEditXna\obj\x86\Release\App.g.cs:line 0
01-15-2012 01:42 v3.1.12009.2302 Error - Object reference not set to an instance of an object.
at TEditXna.Editor.Tools.SpriteTool.MouseDown(TileMouseState e) in D:\Dev\_PROJECTS\Terraria\Terraria-Map-Editor\TEditXna\Editor\Tools\SpriteTool.cs:line 31
at TEditXna.ViewModel.WorldViewModel.MouseDownTile(TileMouseState e) in D:\Dev\_PROJECTS\Terraria\Terraria-Map-Editor\TEditXna\ViewModel\WorldViewModel.cs:line 333
at TEditXna.View.WorldRenderXna.xnaViewport_HwndLButtonDown(Object sender, HwndMouseEventArgs e) in D:\Dev\_PROJECTS\Terraria\Terraria-Map-Editor\TEditXna\View\WorldRenderXna.xaml.cs:line 708
at BCCL.UI.Xaml.XnaContentHost.GraphicsDeviceControl.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in D:\Dev\_PROJECTS\BCCL\BCCL.Xna\UI\Xaml\XnaContentHost\GraphicsDeviceControl.cs:line 479
at System.Windows.Interop.HwndHost.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at TEditXna.App.Main() in D:\Dev\_PROJECTS\Terraria\Terraria-Map-Editor\TEditXna\obj\x86\Release\App.g.cs:line 0