From 1e8ac9c117f1dc51d8bbe70d611451e562ec53e0 Mon Sep 17 00:00:00 2001 From: tihmstar Date: Sat, 31 Dec 2016 18:02:30 +0100 Subject: [PATCH] fixed a bug where futurerestore would segfault if device was in recovery mode already --- futurerestore/futurerestore.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/futurerestore/futurerestore.cpp b/futurerestore/futurerestore.cpp index e202b39c..f2713a87 100644 --- a/futurerestore/futurerestore.cpp +++ b/futurerestore/futurerestore.cpp @@ -244,6 +244,18 @@ uint64_t futurerestore::getBasebandGoldCertIDFromDevice(){ } const char *futurerestore::getDeviceModelNoCopy(){ + if (!_client->device || !_client->device->product_type){ + if (check_mode(_client) < 0) { + error("ERROR: Unable to discover device mode. Please make sure a device is attached.\n"); + return NULL; + } + + if (check_hardware_model(_client) == NULL || _client->device == NULL) { + error("ERROR: Unable to discover device model\n"); + return NULL; + } + } + return _client->device->product_type; }