rather show buggy graphics than crash!

This commit is contained in:
Gesche 2019-01-27 14:25:43 +01:00
parent d1500746c0
commit 0681f02d87
2 changed files with 9 additions and 4 deletions

View File

@ -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? ### What is otclient?

View File

@ -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_layers + l)
* m_size.height() + h) * m_size.height() + h)
* m_size.width() + w; * m_size.width() + w;
assert(index < m_spritesIndex.size()); if (index >= m_spritesIndex.size()) {
return index; return m_spritesIndex.size()-1;
} else {
//assert(Iindex < m_spritesIndex.size());
return index;
}
} }
uint ThingType::getTextureIndex(int l, int x, int y, int z) { uint ThingType::getTextureIndex(int l, int x, int y, int z) {
@ -571,4 +575,4 @@ void ThingType::setPathable(bool var)
m_attribs.remove(ThingAttrNotPathable); m_attribs.remove(ThingAttrNotPathable);
else else
m_attribs.set(ThingAttrNotPathable, true); m_attribs.set(ThingAttrNotPathable, true);
} }