Ellpeck / MLEM

Libraries for MonoGame and FNA that provide abstractions, quality of life improvements and additional features like a ui system and easy input handling.
https://mlem.ellpeck.de/
MIT License
84 stars 6 forks source link

Initializing InputHandler with handleTouch=false leads to crash on Update #10

Closed cassdeckard closed 12 months ago

cassdeckard commented 12 months ago

Environment: MacOS Ventura / M1 (arm64)

Repro steps:

  1. Build and Run the Demo. Note that it runs just fine.
  2. In MlemGame.LoadContent(), modify the initialization of this.InputHandler to set the optional handleX parameters as follows:
    this.InputHandler = new InputHandler(this, true, true, false, false); // everything true but handleTouch
  3. Build and Run again. Note the following runtime error:
    
    "/path/to/mlem/clone/MLEM/Demos.DesktopGL/bin/Debug/net7.0/MLEM Desktop Demos"
    Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
    at MLEM.Ui.UiControls.Update() in /path/to/mlem/clone/MLEM/MLEM.Ui/UiControls.cs:line 226
    at MLEM.Ui.UiSystem.Update(GameTime time) in /path/to/mlem/clone/MLEM/MLEM.Ui/UiSystem.cs:line 274
    at Microsoft.Xna.Framework.Game.<>c.<.cctor>b__116_1(IUpdateable updateable, GameTime gameTime)
    at Microsoft.Xna.Framework.Game.SortingFilteringCollection`1.ForEachFilteredItem[TUserData](Action`2 action, TUserData userData)
    at Microsoft.Xna.Framework.Game.Update(GameTime gameTime)
    at MLEM.Startup.MlemGame.DoUpdate(GameTime gameTime) in /path/to/mlem/clone/MLEM/MLEM.Startup/MlemGame.cs:line 144
    at Demos.GameImpl.DoUpdate(GameTime gameTime) in /path/to/mlem/clone/MLEM/Demos/GameImpl.cs:line 117
    at MLEM.Startup.MlemGame.Update(GameTime gameTime) in /path/to/mlem/clone/MLEM/MLEM.Startup/MlemGame.cs:line 102
    at Microsoft.Xna.Framework.Game.DoUpdate(GameTime gameTime)
    at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
    at Microsoft.Xna.Framework.Game.Run()
    at Demos.DesktopGL.Program.Main() in /path/to/mlem/clone/MLEM/Demos.DesktopGL/Program.cs:line 19
Ellpeck commented 12 months ago

Thanks for the report!

Keep in mind that you can use the private NuGet feed to get this fix for your project if you're using NuGet for your project!