This line of code results in the error Segmentation Fault (Core dumped)
:
collision = detectCollision(window, ball);
if (strcmp(getType(collision), "GRect") == 0)
{
// TODO
}
What is causing the segfault and how can I fix it?
You may also have to make sure it's not null before you try to pass it into getType(). detectCollision will return null when there are no collisions.
What type have you initialized the variable "collision" to be? If you initialized it as a string, that could be the issue.
Make sure you are initializing it as:
GObject collision = detectCollision(window, ball);