stuajnht / HAP-for-iOS

HAP+ for use on iOS devices
GNU General Public License v3.0
5 stars 2 forks source link

Bug: Crash on Incorrect Domain Name #11

Closed stuajnht closed 8 years ago

stuajnht commented 8 years ago

Description:

When setting up the app, if a domain is typed that doesn't have a DNS address or needs to do some redirecting, the app crashes

Steps to Reproduce Bug:

Open app for first setup Type in an invalid HAP+ server address, such as hap.example.com Fill in an invalid username and password Press login button

Expected Result:

There should be an alert displayed to say that the address is invalid

Actual Result:

The app crashes, with the following logged in the log window:

[Debug] ... [LoginViewController.swift:216] checkAPI(_:attempt:) > Attempting to contact the HAP+ server at the URL: https://hap.example.com
fatal error: unexpectedly found nil while unwrapping an Optional value

HAP+ for iOS Version(s):

0.2.0

HAP+ Server Version:

N/A

iOS Device(s):

iPad Air 2

Other Comments:

stuajnht commented 8 years ago

This should be due to the fact that the checkAPI function in the HAPi.swift file doesn't check if the response result was successful.

A check needs to be done to make sure that the response result was successful, similar to what is done in the loginUser function in the same file.