python-sfml icon indicating copy to clipboard operation
python-sfml copied to clipboard

Creating sprites without a texture crashes python

Open tgrajewski opened this issue 7 years ago • 2 comments

This line crashes python:

sprite = sf.Sprite(None)

Would be great if at least an exception could be thrown here. And even better would be if a non-renderable sprite would be created with a possibility of setting a texture later in code.

tgrajewski avatar Feb 23 '17 19:02 tgrajewski

You're right andd actually I'm aware of that, I'll look into that soon!

intjelic avatar Mar 03 '17 20:03 intjelic

To me it looks like it's cythons fault somehow, I mean this works and correctly raises an error:

>>> from sfml import sf
>>> sf.Sprite(False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Argument 'texture' has incorrect type (expected sfml.graphics.Texture, got bool)

But None just straight out segfaults it..

>>> sf.Sprite(None)
Segmentation fault (core dumped)

Necklaces avatar Jun 10 '17 09:06 Necklaces