title: libGDX Null Pointer Exception thrown when attempting to render a particle system
body: <p>So I'm attempting to use a Particle Effect in my game, however, when I run it, it throws the following exception:</p>
  
  <blockquote>
    <p>06-16 15:10:46.585 9136-10049/pt.bluecover.wearable3d
    E/AndroidRuntime: FATAL EXCEPTION: GLThread 78458
                                                                            Process: pt.bluecover.wearable3d, PID: 9136
                                                                            java.lang.NullPointerException: Attempt to read from field
    'com.badlogic.gdx.graphics.g3d.particles.ParallelArray
    com.badlogic.gdx.graphics.g3d.particles.ParticleController.particles'
    on a null object reference
                                                                                at
    com.badlogic.gdx.graphics.g3d.particles.emitters.Emitter.end(Emitter.java:33)
                                                                                at
    com.badlogic.gdx.graphics.g3d.particles.ParticleController.end(ParticleController.java:184)
                                                                                at
    com.badlogic.gdx.graphics.g3d.particles.ParticleController.reset(ParticleController.java:176)
                                                                                at
    com.badlogic.gdx.graphics.g3d.particles.ParticleEffect.reset(ParticleEffect.java:64)
                                                                                at com.mygdx.game.WristPlotter.create(WristPlotter.java:126)
                                                                                at
    com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:290)
                                                                                at
    android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1550)
                                                                                at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1278)</p>
  </blockquote>
  
  <p>However, I'm currently following this tutorial, and I believe I've everything identical: <a href="https://github.com/libgdx/libgdx/wiki/3D-Particle-Effects" rel="nofollow">3D Particle Systems - LibGDX</a></p>
  
  <p>So, what might be wrong? Here's the code:</p>
  
  <pre><code>@Override
      public void create() {
  
          (...)
  
          //particle system stuff
          particleSystem = ParticleSystem.get();
          pointSpriteBatch = new PointSpriteParticleBatch();
          pointSpriteBatch.setCamera(cam);
          particleSystem.add(pointSpriteBatch);
  
          assets = new AssetManager();
          ParticleEffectLoader.ParticleEffectLoadParameter loadParam =
                  new ParticleEffectLoader.ParticleEffectLoadParameter(particleSystem.getBatches());
          ParticleEffectLoader loader = new ParticleEffectLoader(new InternalFileHandleResolver());
          assets.setLoader(ParticleEffect.class, loader);
          assets.load(PARTICLE_PATH, ParticleEffect.class, loadParam);
          assets.finishLoading();
  
          ParticleEffect originalEffect = assets.get(PARTICLE_PATH);
          particles = originalEffect.copy();
          particles.init();
          particleSystem.add(particles);
  
      }
  
  
      @Override
      public void render() {
  
          (...)
  
          int width = Gdx.graphics.getWidth();
          int height = Gdx.graphics.getHeight();
  
          Gdx.gl.glViewport(0, 0, width, height);
          Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
  
          modelBatch.begin(cam);
          modelBatch.render(instancesMap.values(), environment);
          renderParticleEffects();
          modelBatch.end();
  
      }
  
      /**
       * Renders our particle effects.
       * Must be used between modelBatch.begin and modelBatch.end
       */
      private void renderParticleEffects() {
          particleSystem.update(); // technically not necessary for rendering
          particleSystem.begin();
          particleSystem.draw();
          particleSystem.end();
          modelBatch.render(particleSystem);
      }
  </code></pre>
  
  <p>Anyways, thanks in advance!</p>
  
  <p>EDIT: Someone tagged this as a duplicate of "What is a Null Pointer Exception and how do I fix it". Well, this isn't. That question made a general approach on Null Pointer Exceptions. This one refers to the usage of this particular library, libGDX, and where am I failing to add something that could cause the data structure that stores the particles in a particle system to not have the particle effects I loaded previously...</p>