From 0681f02d87ac123e55b2ff2c01dd08e89dd19daf Mon Sep 17 00:00:00 2001 From: Gesche Gierse Date: Sun, 27 Jan 2019 14:25:43 +0100 Subject: [PATCH] rather show buggy graphics than crash! --- README.md | 3 ++- src/client/thingtype.cpp | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 12b5edab..ca7a77a6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -[![Build Status](https://secure.travis-ci.org/edubart/otclient.svg?branch=master)](http://travis-ci.org/edubart/otclient) [![Join the chat at https://gitter.im/edubart/otclient](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/edubart/otclient?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\ +This is a fork from [otclient](https://github.com/edubart/otclient) + ### What is otclient? diff --git a/src/client/thingtype.cpp b/src/client/thingtype.cpp index 28d6b3b6..5e728c7f 100644 --- a/src/client/thingtype.cpp +++ b/src/client/thingtype.cpp @@ -544,8 +544,12 @@ uint ThingType::getSpriteIndex(int w, int h, int l, int x, int y, int z, int a) * m_layers + l) * m_size.height() + h) * m_size.width() + w; - assert(index < m_spritesIndex.size()); - return index; + if (index >= m_spritesIndex.size()) { + return m_spritesIndex.size()-1; + } else { + //assert(Iindex < m_spritesIndex.size()); + return index; + } } uint ThingType::getTextureIndex(int l, int x, int y, int z) { @@ -571,4 +575,4 @@ void ThingType::setPathable(bool var) m_attribs.remove(ThingAttrNotPathable); else m_attribs.set(ThingAttrNotPathable, true); -} \ No newline at end of file +}