Resolved IllegalArgumentException for touch

An illegalArgumentException was being thrown on simultaneous touch/taps
on the screen which caused the app to crash. This was due to the
PointerIndex being set to -1.
This error has been resolved by adding an IF-condition to avoid exceptions being thrown.

The error stack trace is as follows:

12-13 01:59:40.886  25409-25409/? E/AndroidRuntime﹕ FATAL EXCEPTION:
main
java.lang.IllegalArgumentException: pointerIndex out of range
at android.view.MotionEvent.nativeGetAxisValue(Native Method)
at android.view.MotionEvent.getHistoricalX(MotionEvent.java:2550)
at
edu.luc.etl.cs313.scala.uidemo.controller.TrackingTouchListener$$anonfun$onTouch$1$$anonfun$apply$mcVI$sp$1.apply$mcVI$sp(TrackingTouchListener.scala:34)
at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:141)
at
edu.luc.etl.cs313.scala.uidemo.controller.TrackingTouchListener$$anonfun$onTouch$1.apply$mcVI$sp(TrackingTouchListener.scala:31)
at
edu.luc.etl.cs313.scala.uidemo.controller.TrackingTouchListener$$anonfun$onTouch$1.apply(TrackingTouchListener.scala:29)
at
edu.luc.etl.cs313.scala.uidemo.controller.TrackingTouchListener$$anonfun$onTouch$1.apply(TrackingTouchListener.scala:29)
at
scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
at
edu.luc.etl.cs313.scala.uidemo.controller.TrackingTouchListener.onTouch(TrackingTouchListener.scala:29)
at android.view.View.dispatchTouchEvent(View.java:7466)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2215)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1958)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2215)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1958)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2215)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1958)
at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2215)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1958)
at
com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2054)
at
com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1503)
at android.app.Activity.dispatchTouchEvent(Activity.java:2486)
at
com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2002)
at android.view.View.dispatchPointerEvent(View.java:7687)
at
android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4223)
at
android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4118)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3692)
at
android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3742)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3711)
at
android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3796)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3719)
at
android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3853)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3692)
at
android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3742)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3711)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3719)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3692)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5784)
at
android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5757)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5720)
at
android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5862)
at
android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:211)
at
android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native
Method)
at
android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:198)
at
android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:5839)
at
android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:5891)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:786)
at android.view.Choreographer.doCallbacks(Choreographer.java:586)
at android.view.Choreographer.do