summaryrefslogtreecommitdiff
path: root/light/Light.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'light/Light.cpp')
-rw-r--r--light/Light.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/light/Light.cpp b/light/Light.cpp
index c170ae2..786e8c2 100644
--- a/light/Light.cpp
+++ b/light/Light.cpp
@@ -39,7 +39,14 @@ namespace implementation {
*/
static void set(std::string path, std::string value) {
std::ofstream file(path);
- file << value;
+ /* Only write brightness value if stream is open, alive & well */
+ if (file.is_open()) {
+ file << value;
+ } else {
+ /* Fire a warning a bail out */
+ ALOGE("failed to write %s to %s", value.c_str(), path.c_str());
+ return;
+ }
}
static void set(std::string path, int value) {