Why does my code give NullPointerException error?

Excerpt of the original post before any moderation edits:

    tex.line(cx1 + sin(radians(angle)) * width, cy1 + cos(radians(angle)) * height, cx1 + sin(radians(angle + 180)) * width, cy1 + cos(radians(angle + 180)) * height);
    tex.endDraw();
  }
}