Probably not the shortest solution, but it works and covers edge cases

"""

```
class Solution(object):
def firstMissingPositive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return 1
for negN in sorted(nums):
minN = min(nums)
if minN <= 0:
nums.pop(nums.index(minN))
else:
break
if not nums:
return 1
for i in sorted(nums):
if not 1 in nums:
return 1
elif i - 1 > 0 and i - 1 not in nums:
return i - 1
elif i + 1 not in nums:
return i + 1
```

"""