Arduino autoreset after recieving data from bluetooth

Hello,
So I am having issues on my project. Working on leds 12V 12v ws2811 controlled by bluetooth using arduino uno (clone).
Everytime i try to send data to bluetooth, it resets the arduino and it goes again through setup.
I tried sending data from processing or phone with same result. The weird thing is that if i upload older version of my code, it works.
new version of code:

#define pinA A0
#define pinD 3


#define DATA_PIN 10
const int OnOffpin = 6;
const int Swappin = 7;

int bytes[3];
#include <Adafruit_NeoPixel.h>

#define NUM_LEDS 60
// 59 je na stole
#define PIR_sensor 5

Adafruit_NeoPixel table(NUM_LEDS, 2, NEO_GRB + NEO_KHZ800);

int sensor, aa;
char moving;
int brightness;
int rbr = 0;
int gbr = 0;
int bbr = 255;
int rbrr, bbrr, gbrr;
int dataread[20];
int FadeSpeed = 10;
boolean lumos = false, On = false;
int j;
int data_i = 0;


void setup() {
  delay(1000);
  Serial.begin(9600);
  Serial.println("printuji");
  pinMode(OnOffpin, INPUT);
  pinMode(Swappin, INPUT);
  pinMode(5, INPUT);
  table.begin();
  table.show();
  for (int i = 0; i < NUM_LEDS; i++) {
    table.setPixelColor(i, 255, 0, 0);
    table.show();
    delay(10);
  }
  for (int i = 0; i < NUM_LEDS; i++) {
    table.setPixelColor(i, 0, 255, 0);
    table.show();
    delay(10);
  }
  for (int i = 0; i < NUM_LEDS; i++) {
    table.setPixelColor(i, 0, 0, 255);
    table.show();
    delay(10);
  }
  turnalloff();
}

void loop() {

  if (Serial.available() > 0) {
    Serial.println("Data available");
    datar();
    switch1();
    lightup();
  }
  buttonOnOff();
  buttonSwap();


}

void datar() {
  data_i = 0;
  while (Serial.available() > 0) {
    dataread[data_i] = Serial.read();
    Serial.println(dataread[data_i]);
    data_i++;
    delay(10);
  }
}
void lightup() {
  if (lumos) { //rozsviti s rbr, gbr, bbr
    // staci kdyz projde jednou, jedna se jen o barevne zmeny bez modu
    lumos = false;
    for (int i = 0; i < round((NUM_LEDS) / 2); i++) { // nastav do for loopu neznamou pro zmeneni od kama kam
      //od kraje do stredu
      //  table.setPixelColor(i, rbr, gbr, bbr);
      //  table.setPixelColor(NUM_LEDS-i, rbr, gbr, bbr);
      // od stredu do kraje
      table.setPixelColor((NUM_LEDS) / 2 + i, rbr, gbr, bbr);
      table.setPixelColor((NUM_LEDS) / 2 - i, rbr, gbr, bbr);
      table.show();
      delay(50);
    }
  }
}
void buttonSwap() { // bude swapovat funkce a barvy, zatim necham, dodelam pak
  int swap = digitalRead(Swappin);
  if (swap == HIGH) {
    dataread[0] = 1;

    // dataread[
  }
}
void buttonOnOff() {
  int OnOff = digitalRead(OnOffpin);
  if (OnOff == HIGH) {
    if (On) {
      dataread[0] = 0;
      On = false;
    } else {
      dataread[0] = 1;
      dataread[1] = rbr;
      dataread[2] = bbr;
      dataread[3] = gbr;
      On  = true;
    }
    switch1();
  }
}
void resetdata() {
  for (int reset = 0; reset < sizeof(dataread); reset++) {
    dataread[reset] = 0;
  }
}
void turnalloff() {
  lumos = false;
  for (int i = 0; i < round((NUM_LEDS + 2) / 2); i++) {
    //od kraje do stredu
    table.setPixelColor(i, 0, 0, 0);
    table.setPixelColor(NUM_LEDS - i, 0, 0, 0);
    // od stredu do kraje
    //  table.setPixelColor((NUM_LEDS)/2+i, 0, 0, 0);
    //  table.setPixelColor((NUM_LEDS)/2-i, 0, 0, 0);
    table.show();
    delay(50);
  }
  table.clear(); table.show();
}

void switch1 () {
  switch (dataread[0]) {
    case 0:
      turnalloff();
      break;
    case 1:
      lumos = true;
      rbr = dataread[1];
      gbr = dataread[2];
      bbr = dataread[3];
      break;
    case 15:
      Serial.println("Rainbow");
      rainbowCycle(10);
      break;
    case 16:
      Serial.println("Fade");
      FadeInOut(rbr, gbr, bbr, 10);
      datar();
      break;
    case 17 :
      Serial.println("case 17");
      CylonBounce(rbr, gbr, bbr, 4, 10, 10);
      break;
    case 18:
      Serial.println("case 18");
      RunningLights(rbr, gbr, bbr, 10);
      datar();
      break;
    case 19:
      Serial.println("case 19");
      theaterChase(rbr, gbr, bbr, 250);
      break;
    case 20:
      Serial.println("case 20");
      meteorRain(rbr, gbr, bbr, 10, 64, true, 30);
      break;
  }
  resetdata();
}

I had to delete some functions due to limit on forum

I have to say, that I am just learning all of this.
Thank you for your responses and for your time

You are writing past the end of the dataread array. sizeof() gives you the number of bytes in the array, which is not the same as the number of elements in the array. On most arduino's int is two bytes, so sizeof() will be 40. To get the number of elements in the array you take sizeof() the array and divide by sizeof() a single element of the array.

int dataread[20];

void resetdata() {
  //for (int reset = 0; reset < sizeof(dataread); reset++) {
  for (int reset = 0; reset < sizeof(dataread)/sizeof(dataread[0]); reset++) {
    dataread[reset] = 0;
  }
}

Thank you David for your time. I was too quick with reading that function i guess, my bad. Now everything quite works good, just need to upgrade my receiving data, so I get all data i need, but I will try it on my own.
Thank you a lot