Why am I getting this error message?

I’m getting this message in the unity console window:
ArgumentException: Index out of bounds.
UnityEngine.Input.GetTouch (Int32 index) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/InputBindings.gen.cs:619)
TouchTest2.Update () (at Assets/TouchTest2.cs:18)

This is my code in Microsoft visual studio:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TouchTest2 : MonoBehaviour
{

Ray ray;
// Use this for initialization
void Start()
{

}

// Update is called once per frame
void Update()
{
    if (Input.touchCount > 0 || Input.GetTouch(0).phase == TouchPhase.Began)
    {

        ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);

        Debug.DrawRay(ray.origin, ray.direction * 20);

        if (Physics.Raycast(ray, Mathf.Infinity))
        {
            Debug.Log("Hit Something");
        }

    }
}

}

The if statement should be:

if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) {
    //...
}

In this setup, if Input.touchCount is less than or equal to zero ( Input.touchCount > 0 is false) then the second condition is never evaluated.

With the OR operator, this is not the case. It’s looking for a 0th touch input when there is none.