Weird assertion error when im trying to create a new window

Hello, i have the following code:

glfwSetErrorCallback(error_callback);
	if (!glfwInit())
	{
		printf("Failed to initialize GLFW\n");
		return -1;
	}
	engine.gameWin = glfwCreateWindow(engine.width, engine.height, engine.GetTitle().c_str(), NULL, NULL);
	if (engine.gameWin == NULL)
	{
		printf("Failed to create GLFW Window.\n");
		glfwTerminate();
		return -1;
	}

engine.width, engine,height and engine.GetTitle() is all not empty or null. They have their default value set.
and it compiled successfully but when i try to run it i get this error:

Assertion failed: (window != NULL), function glfwSetWindowTitle, file window.c, line 498.

What is the issue here? Please help me!

I think you might not be posting the full source code, since the error is in the function glfwSetWindowTitle which I can’t see in your code snippet, and it’s not called internally by GLFW.

I wonder what your function engine.GetTitle() does and could this somehow be calling glfwSetWindowTitle before the window is created, so engine.gameWin is NULL?

I just solved it. I forgot to let it check whether the gameWin is null or not before setting the title. Thanks alot! :grin: