diff --git a/.gitignore b/.gitignore
index 5acf88f9ac8c302f8d4093d9a0c011bd1c64619a..e9e8e08ab2c9bb73ea88cc085136d14d75fa450b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,12 +4,12 @@ lib/*
 include/csm/*
 
 # iPython checkpoint items
-.ipynb_checkpoints/*
+.ipynb_checkpoints
 
 # Ignore any executables
 bin/*
 
-# Ignore any Max stuff
+# Ignore any Mac stuff
 .DS_Store
 
 *.cpython*
diff --git a/src/UsgsAstroLsSensorModel.cpp b/src/UsgsAstroLsSensorModel.cpp
index df705e10a79e0c440b7da393313559deed3665ab..d16eefe59cd1bb8691f1f3305f76cf6886705231 100644
--- a/src/UsgsAstroLsSensorModel.cpp
+++ b/src/UsgsAstroLsSensorModel.cpp
@@ -299,6 +299,15 @@ csm::ImageCoord UsgsAstroLsSensorModel::groundToImage(
    double dz = ground_pt.z - calculatedPoint.z;
    double len = dx * dx + dy * dy + dz * dz;
 
+   // Check that the pixel is actually in the image
+   if ((calculatedPixel.samp < 0) ||
+       (calculatedPixel.samp > _data.m_TotalSamples)) {
+      throw csm::Error(
+         csm::Error::ALGORITHM,
+         "Ground point is not viewed by the image.",
+         "UsgsAstroLsSensorModel::groundToImage");
+   }
+
    // If the final correction is greater than 10 meters,
    // the solution is not valid enough to report even with a warning
    printf("%f\n", len);