# Assertion failed: title != NULL in window.c error which calls abort() after debbuging

**URL:** <https://discourse.glfw.org/t/assertion-failed-title-null-in-window-c-error-which-calls-abort-after-debbuging/1170>\
**Category:** support\
**Created:** [September 11, 2018, 9:42pm UTC](https://discourse.glfw.org/t/assertion-failed-title-null-in-window-c-error-which-calls-abort-after-debbuging/1170 "2018-09-11T21:42:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![StabberKnight906](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@StabberKnight906](https://discourse.glfw.org/u/StabberKnight906)\
**Post date:** [September 11, 2018, 9:42pm UTC](https://discourse.glfw.org/t/assertion-failed-title-null-in-window-c-error-which-calls-abort-after-debbuging/1170/1 "2018-09-11T21:42:10Z")

</div>

Well i got stumped for two days looking for solution of this problem and i don’t know what should i do i tried multiple fixes with no results.Maybe there is a problem with my code which i can’t see.

> [@Window.h](#):
>
> #pragma once
> 
> #ifndef WINDOW\_H  
> #define WINDOW\_H
> 
> #include \<glad/glad.h\>  
> #include \<GLFW/glfw3.h\>  
> #include
> 
> class Window  
> {  
> private:  
> int corwidth, corheight;  
> const char \*cortitle;  
> GLFWwindow \*corwindow;  
> public:  
> Window(int width,int height,const char \*title);  
> ~Window();  
> bool closed() const;  
> void clear() const;  
> void update() const;  
> private:  
> bool init();  
> };
> 
> #endif

> [@Window.cpp](#):
>
> #include “Window.h”
> 
> Window::Window(int width, int height, const char \*title)  
> {   
> width = corwidth;  
> height = corheight;  
> title = cortitle;
> 
> ```
> if (!init())
> {
> glfwTerminate();
> }
> 
> ```
> 
> }
> 
> Window::~Window()  
> {  
> glfwTerminate();  
> }
> 
> bool Window::init()  
> {  
> if (!glfwInit())  
> {  
> glfwTerminate();  
> std::cout \<\< “GLFW KLAIDA:NEPAVYKO INICIJUOTI GLFW” \<\< std::endl;  
> return false;  
> }  
> corwindow = glfwCreateWindow(corwidth, corheight, cortitle, NULL, NULL);  
> if (!corwindow)  
> {  
> glfwTerminate();  
> std::cout \<\< “GLFW KLAIDA:NEPAVYKO SUKURTI GLFW LANGO” \<\< std::endl;  
> return false;  
> }  
> glfwMakeContextCurrent(corwindow);  
> if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))  
> {  
> std::cout \<\< “GLAD KLAIDA:NEPAVYKO INICIJUOTI OPENGL” \<\< std::endl;  
> return false;  
> }  
> std::cout \<\< “GPU:” \<\< glGetString(GL\_RENDERER) \<\< " VENDOR:" \<\< glGetString(GL\_VENDOR) \<\< std::endl;  
> return true;  
> }
> 
> void Window::clear() const  
> {  
> glClear(GL\_COLOR\_BUFFER\_BIT | GL\_DEPTH\_BUFFER\_BIT);  
> }
> 
> void Window::update() const  
> {  
> glfwPollEvents();  
> glfwSwapBuffers(corwindow);  
> }
> 
> bool Window::closed() const  
> {  
> return glfwWindowShouldClose(corwindow);  
> }

> [@main.cpp](#):
>
> /\*#include \<glad/glad.h\>  
> #include \<glfw/glfw3.h\>  
> #include \*/
> 
> #include “Window.h”  
> int main()  
> {  
> Window Window(640, 640, “FRTI ENGINE”);  
> glClearColor(1.0, 0.0, 0.0, 1.0);
> 
> ```
> while (!Window.closed())
> {
> Window.clear();
> Window.update();
> }
> 
> return 0;
> 
> ```
> 
> }

Error feedback is in our native language:Lithuanian.  
Glfw3 was built in cmake for 64bit windows application and code is debugged in 64bit.  
For now application has to show red screen.  
Coding architecture is inspired by Cherno’s sparky engine.  
Main problem occurs after debbuging which in my case says Assertion failed: title != NULL, file c:\users\stabberknight906\documents\opengl\src\glfw-3.2.1\src\window.c, line 130. Which follows with Microsoft’s Visual c++ Runtime Library error: Debug Error! Program FRTI engine.exe. abort() has been called.

---

<div class="post-metadata">

**Author:** ![mmozeiko](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/mmozeiko/32/29_2.png) [@mmozeiko](https://discourse.glfw.org/u/mmozeiko)\
**Post date:** [September 11, 2018, 10:41pm UTC](https://discourse.glfw.org/t/assertion-failed-title-null-in-window-c-error-which-calls-abort-after-debbuging/1170/2 "2018-09-11T22:41:17Z")

</div>

Please use proper code formatting for easier reading (put three ` symbols before and after code).

The error is in your Window constructor - you are not initializing corwidth/corheight/cortitle members of object. Instead you are overwriting widht/height/title arguments with uninitialized values from `this` object. cortitle happens to be NULL, that’s why you are hitting the assert when passing it to glfwCreateWindow function.

In this kind of situation you should really use a debugger. Run program in a debugger, and when code will assert the debugger will stop. And you will be able to examine call stack. In your case you would see that the function Window::init called glfwCreateWindow which asserted. Then you would be able to examine variable values - like corwidth, cortitle - then you would immediately see where is the error.

---

<div class="post-metadata">

**Author:** ![StabberKnight906](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@StabberKnight906](https://discourse.glfw.org/u/StabberKnight906)\
**Post date:** [September 12, 2018, 12:17pm UTC](https://discourse.glfw.org/t/assertion-failed-title-null-in-window-c-error-which-calls-abort-after-debbuging/1170/3 "2018-09-12T12:17:37Z")

</div>

Thank you very much i found the culprit of this error, instead of

```auto
width = corwidth;
height = corheight;
title = cortitle;

```

it should have been

```auto
corwidth = width;
corheight = height;
cortitle = title;

```
