<commit_before>package it.playfellas.superapp.network;

import it.playfellas.superapp.events.NetEvent;
import java.io.IOException;

public class SlavePeer {

  private BTSlaveThread btSlaveThread;
  private static SlavePeer slave;

  private SlavePeer() {
    super();
  }

  public synchronized static SlavePeer get() {
    if (slave == null) {
      slave = new SlavePeer();
    }
    return slave;
  }

  public void listenForConnection() throws IOException {
    btSlaveThread = new BTSlaveThread();
    btSlaveThread.start();
  }

  public void close() {
    btSlaveThread.deactivate();
  }

  public void sendMessage(NetEvent netEvent) throws IOException {
    btSlaveThread.write(netEvent);
  }
}
<commit_msg>fix on close null slave thread<commit_after>package it.playfellas.superapp.network;

import it.playfellas.superapp.events.NetEvent;
import java.io.IOException;

public class SlavePeer {

  private BTSlaveThread btSlaveThread;
  private static SlavePeer slave;

  private SlavePeer() {
    super();
  }

  public synchronized static SlavePeer get() {
    if (slave == null) {
      slave = new SlavePeer();
    }
    return slave;
  }

  public void listenForConnection() throws IOException {
    btSlaveThread = new BTSlaveThread();
    btSlaveThread.start();
  }

  public void close() {
    if(btSlaveThread != null) {
      btSlaveThread.deactivate();
    }
  }

  public void sendMessage(NetEvent netEvent) throws IOException {
    btSlaveThread.write(netEvent);
  }
}

{'fraction_non_alphanumeric': 0.09670920080591, 'fraction_numerical': 0.0, 'mean_word_length': 3.613003095975232, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4263299', 'n_tokens_mistral': 473, 'n_tokens_neox': 464, 'n_words': 111}