From b64bb3bec975846131ba3d35e9fb08027b167ac2 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 28 Dec 2023 19:21:15 +0100 Subject: [PATCH] fix: Crashes when opening diffing view --- plugins/ui/include/ui/hex_editor.hpp | 2 +- plugins/ui/source/ui/hex_editor.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/ui/include/ui/hex_editor.hpp b/plugins/ui/include/ui/hex_editor.hpp index ec969cddb..303c24cc9 100644 --- a/plugins/ui/include/ui/hex_editor.hpp +++ b/plugins/ui/include/ui/hex_editor.hpp @@ -262,7 +262,7 @@ namespace hex::ui { m_tooltipCallback = callback; } - [[nodiscard]] i64 getScrollPosition() const { + [[nodiscard]] i64 getScrollPosition() { return m_scrollPosition.get(); } diff --git a/plugins/ui/source/ui/hex_editor.cpp b/plugins/ui/source/ui/hex_editor.cpp index c76ad7687..7a5013194 100644 --- a/plugins/ui/source/ui/hex_editor.cpp +++ b/plugins/ui/source/ui/hex_editor.cpp @@ -311,7 +311,7 @@ namespace hex::ui { { const auto window = ImGui::GetCurrentWindowRead(); const auto axis = ImGuiAxis_Y; - ImS64 numRows = (m_provider->getSize() / m_bytesPerRow) + ((m_provider->getSize() % m_bytesPerRow) == 0 ? 0 : 1); + ImS64 numRows = m_provider == nullptr ? 0 : (m_provider->getSize() / m_bytesPerRow) + ((m_provider->getSize() % m_bytesPerRow) == 0 ? 0 : 1); const auto outerRect = window->Rect(); const auto innerRect = window->InnerRect;