Check if modified and sortindex are set

Check if modified and sortindex are set before accessing them.
Avoids needless entries in the ownCloud log.