Skip to content
Browse files

fix crash when no proxy value in preferences

  • Loading branch information...
1 parent 2dcf3c1 commit c4c7c975820584fa7a6297d30d5cea1c80814f4d @iptton iptton committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 mainwindow.cpp
View
4 mainwindow.cpp
@@ -653,7 +653,7 @@ void MainWindow::toggleProxy(){
CFNumberRef httpEnabled = (CFNumberRef)CFDictionaryGetValue(proxies, kSCPropNetProxiesHTTPEnable);
CFNumberRef httpsEnabled = (CFNumberRef)CFDictionaryGetValue(proxies, kSCPropNetProxiesHTTPSEnable);
int tmp;
- if (CFNumberGetValue(httpEnabled, kCFNumberIntType, &tmp) && tmp){
+ if (httpEnabled && CFNumberGetValue(httpEnabled, kCFNumberIntType, &tmp) && tmp){
CFStringRef host = (CFStringRef)CFDictionaryGetValue(proxies, kSCPropNetProxiesHTTPProxy);
CFNumberRef port = (CFNumberRef)CFDictionaryGetValue(proxies, kSCPropNetProxiesHTTPPort);
QString hostQ = QString::fromUtf8( CFStringGetCStringPtr(host,kCFStringEncodingUTF8) );
@@ -663,7 +663,7 @@ void MainWindow::toggleProxy(){
//qDebug()<<proxyStr;
ProxyAutoConfig::instance()->setHttpProxy(proxyStr);
}
- if (CFNumberGetValue(httpsEnabled, kCFNumberIntType, &tmp) && tmp){
+ if (httpsEnabled && CFNumberGetValue(httpsEnabled, kCFNumberIntType, &tmp) && tmp){
CFStringRef host = (CFStringRef)CFDictionaryGetValue(proxies, kSCPropNetProxiesHTTPSProxy);
CFNumberRef port = (CFNumberRef)CFDictionaryGetValue(proxies, kSCPropNetProxiesHTTPSPort);
QString hostQ = QString::fromUtf8( CFStringGetCStringPtr(host,kCFStringEncodingUTF8) );

0 comments on commit c4c7c97

Please sign in to comment.
Something went wrong with that request. Please try again.