Skip to content

Commit

Permalink
Camera Calibration: Fix hangup and null pointer exception
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmax authored and t-oster committed Sep 11, 2018
1 parent fe1b60a commit af8129d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/com/t_oster/visicut/gui/CamCalibrationDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ public void fetchFreshImage() {
if (src != null)
{
URLConnection conn = src.openConnection();
conn.setConnectTimeout(5 * 1000); // 5s connect timeout
conn.setReadTimeout(30 * 1000); // 30s read timeout after connecting


// HTTP authentication
if (VisicutModel.getInstance() != null && VisicutModel.getInstance().getSelectedLaserDevice() != null)
Expand Down Expand Up @@ -150,6 +153,9 @@ public void fetchFreshImage() {

private void refreshImagePoints()
{
if (backgroundImage == null) {
return;
}
int numPriorPoints = 0;
if (modifiedImagePoints == null) {
modifiedImagePoints = new Point2D.Double[numAlignmentPoints];
Expand Down
2 changes: 2 additions & 0 deletions src/com/t_oster/visicut/misc/DialogHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ public static String getHumanReadableErrorMessage(Throwable cause, String text,
boolean emptyMessage = cause.getMessage() == null || cause.getMessage().trim().length() == 0;
if (alwaysShowStacktrace ||
cause.getClass().equals(NullPointerException.class) ||
cause.getClass().equals(ArrayIndexOutOfBoundsException.class) ||
cause.getClass().equals(ClassCastException.class) ||
(cause.getClass().equals(Exception.class) && emptyMessage))
{
StackTraceElement[] stackTrace = cause.getStackTrace();
Expand Down

0 comments on commit af8129d

Please sign in to comment.