Created validate_device_id() function
Added null check for $id
Merge pull request #257 from laf/issue-laf-16

Created validate_device_id() function