ESP32 crash when send a http request

This is my code. What i want is send a request if pin change a status.

#include <WiFi.h>
#include <WebServer.h>
#include <FastLED.h>
#include <EEPROM.h>
#include <HTTPClient.h>

// Definície k LED pásu
#define NUM_LEDS 42
#define LED_PIN 2
#define LED_TYPE WS2813
#define COLOR_ORDER GRB
#define BRIGHTNESS 100
CRGB leds[NUM_LEDS];

// Nastavenia pre webserver
char ssid[32] = "xxx";
char password[32] = "sss";
WebServer server(80);

// EEPROM address definitions
#define EEPROM_SIZE 512
#define IP_ADDR_START 0
#define SEGMENT_COLORS_START 16
#define SEGMENT_RANGES_START 64
#define SEGMENT_POLARITY 128
#define WIFI_CREDENTIALS_START 256
#define MONITOR_PIN14_ADDR 320

String HOST_NAME = "http://192.168.0.7";
String PHP_FILE_NAME = "/insert_data.php";
String tempQuery = "?temperature=31.0";


IPAddress staticIP(192, 168, 0, 50);  // Default static IP address
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);

IPAddress apIP(192, 168, 0, 50);  // IP address for AP mode
IPAddress apGateway(192, 168, 0, 1);
IPAddress apSubnet(255, 255, 255, 0);


const int segmentPins[] = { 14, 27, 26, 25, 33, 32 };
CRGB segmentColors[] = { CRGB::Orange, CRGB::Blue, CRGB::Green, CRGB::Red, CRGB::Purple, CRGB::Yellow };
int segmentRanges[][2] = { { 1, 7 }, { 8, 14 }, { 15, 21 }, { 22, 28 }, { 29, 35 }, { 36, 42 } };
bool polarity[] = { false, false, false, false, false, false };
bool monitorPin14 = false;
int lastPin14State = LOW;
------
void loop() {
  server.handleClient();

  for (int i = 0; i < 6; i++) {
    controlSegmentPower(segmentPins[i], segmentColors[i], segmentRanges[i][0], segmentRanges[i][1], polarity[i]);
  }
}
void controlSegmentPower(int segmentPin, CRGB segmentColor, int startIndex, int endIndex, bool polarity) {
 if (monitorPin14 and segmentPin == 14) {
    // Monitor Pin 14 logic
    int currentPin14State = digitalRead(14);
    Serial.println(currentPin14State);
    if (currentPin14State != lastPin14State) {
      if (currentPin14State == LOW) {
        sendHTTPRequest(); // Call function to send HTTP request
      }
      lastPin14State = currentPin14State;
    }
  }

  if (polarity == false) {
    if (digitalRead(segmentPin) == HIGH) {
      delay(100);
      for (int i = startIndex; i <= endIndex; i++) {
        leds[i] = segmentColor;
      }
    } else {
      for (int i = startIndex; i <= endIndex; i++) {
        leds[i] = CRGB::Black;
      }
    }
  } else {
    if (digitalRead(segmentPin) == LOW) {
      delay(100);
      for (int i = startIndex; i <= endIndex; i++) {
        leds[i] = segmentColor;
      }
    } else {
      for (int i = startIndex; i <= endIndex; i++) {
        leds[i] = CRGB::Black;
      }
    }
  }
  FastLED.show();
  delay(100);
}

void sendHTTPRequest() {
  try {
    if (WiFi.status() == WL_CONNECTED) {
      HTTPClient http;
      String url = HOST_NAME + PHP_FILE_NAME + tempQuery;
      Serial.println("URL: " + url);

      http.begin(url.c_str());
      int httpCode = http.GET();
      if (httpCode > 0) {
        String payload = http.getString();
        Serial.println("Response payload: " + payload);
      } else {
        Serial.println("Error on HTTP request");
      }
      http.end();
    } else {
      Serial.println("WiFi not connected");
    }
  } catch (const std::exception &e) {
    Serial.println("Exception occurred: " + String(e.what()));
  } catch (...) {
    Serial.println("Unknown exception occurred");
  }
}
and in the moment when system receive input I see this and I dont have any idea what the hack.

Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

Core 1 register dump:
PC : 0x400e2ac1 PS : 0x00060d30 A0 : 0x800e2b8c A1 : 0x3ffb2170
A2 : 0x3ffc3fc4 A3 : 0x3ffb21ba A4 : 0x00000000 A5 : 0x00000000
A6 : 0x00000009 A7 : 0x00000004 A8 : 0x00000060 A9 : 0x3ffb2160
A10 : 0x00000001 A11 : 0x3ffb21bb A12 : 0x00000001 A13 : 0x0000ff00
A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x0000001d EXCCAUSE: 0x0000001c

Start with something much simpler. Make a small test-sketch to test only the GET.
This is a tutorial: https://randomnerdtutorials.com/esp32-http-get-post-arduino/

You can type the url in the browser, to see if you get data.

Does the "try - catch" work in the ESP32 ?

You tried to load from an invalid address. This is usually some form of bad pointer (unset, NULL, array out of bound, etc). Run the exception data through the ESP Exception Decoder to get a clue where things went wrong.

Is the catch block for std::exception supported on ESP32?

Exceptions work on ESP32. There's no RTTI (by default), so you can't do dynamic_cast -- however

#include <stdexcept>

void setup() {
  Serial.begin(115200);
}

void loop() {
  delay(1500);
  int *bad = nullptr;
  try {
    if (bad) {
      *bad = 42;
    } else {
      throw std::runtime_error("bad is bad");
    }
    Serial.println("good");
  } catch (const std::exception &e) {
    Serial.println("Exception occurred: " + String(e.what()));
  } catch (...) {
    Serial.println("Unknown exception occurred");
  }
  Serial.println("after");
}

prints bad is bad. The problem is that unlike Java for example, there is no NullPointerException. A "crash" can be caught at the OS level, to perhaps call a custom hook. But with C++, there's no VM or runtime doing that kind of bounds and sanity checking that throws. It's too much overhead. (Windows is an, uh, exception in that it provides kernel-level support to enable __try and __catch extensions in Microsoft C++ to provide Structured Exception Handling that can catch a "crash".)