From 7545256d1f3256ed609f4956de1ff511057acccf Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 4 Apr 2020 22:39:13 +0400 Subject: [PATCH] Do not try to launch magic bolt when direction to target is empty (bug #5350) --- CHANGELOG.md | 1 + apps/openmw/mwworld/projectilemanager.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d765c1bcc..f43c9f9d1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -211,6 +211,7 @@ Bug #5326: Formatting issues in the settings.cfg Bug #5328: Skills aren't properly reset for dead actors Bug #5345: Dopey Necromancy does not work due to a missing quote + Bug #5350: An attempt to launch magic bolt causes "AL error invalid value" error Bug #5352: Light source items' duration is decremented while they aren't visible Feature #1774: Handle AvoidNode Feature #2229: Improve pathfinding AI diff --git a/apps/openmw/mwworld/projectilemanager.cpp b/apps/openmw/mwworld/projectilemanager.cpp index 73f8ac667a..c34c9c77fb 100644 --- a/apps/openmw/mwworld/projectilemanager.cpp +++ b/apps/openmw/mwworld/projectilemanager.cpp @@ -291,6 +291,12 @@ namespace MWWorld if (state.mEffects.mList.empty()) return; + if (!caster.getClass().isActor() && fallbackDirection.length2() <= 0) + { + Log(Debug::Warning) << "Unable to launch magic bolt (direction to target is empty)"; + return; + } + MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), state.mIdMagic.at(0)); MWWorld::Ptr ptr = ref.getPtr();